mirror of
https://github.com/ConjureETS/Human-Farm-Tycoon.git
synced 2026-03-24 02:11:07 +00:00
Panel for ressource work.
This commit is contained in:
parent
f1d0093b5d
commit
d71e178ce6
68
Assets/Controller/WorkerControllerMeat.cs
Normal file
68
Assets/Controller/WorkerControllerMeat.cs
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class WorkerControllerMeat : MonoBehaviour
|
||||||
|
{
|
||||||
|
|
||||||
|
public Text nbWorker;
|
||||||
|
public Text zombieAvailable;
|
||||||
|
public Text nbRessourceExpected;
|
||||||
|
public Button AddButton;
|
||||||
|
public Button RemoveButton;
|
||||||
|
private Stats stats;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void AddWorker()
|
||||||
|
{
|
||||||
|
stats.removeZombieAvail();
|
||||||
|
stats.NbZombieAssigneMeat++;
|
||||||
|
UpdateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LessWorker()
|
||||||
|
{
|
||||||
|
stats.addZombieAvail();
|
||||||
|
stats.NbZombieAssigneMeat--;
|
||||||
|
UpdateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateView()
|
||||||
|
{
|
||||||
|
zombieAvailable.text = stats.AmountOfZombiesAvail + "/" + stats.AmountOfZombies;
|
||||||
|
nbRessourceExpected.text = "" + stats.NbOfMeatByZombie * stats.NbZombieAssigneMeat;
|
||||||
|
nbWorker.text = "" + stats.NbZombieAssigneMeat;
|
||||||
|
|
||||||
|
if (stats.AmountOfZombiesAvail <= 0)
|
||||||
|
{
|
||||||
|
AddButton.enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddButton.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.NbZombieAssigneMeat <= 0)
|
||||||
|
{
|
||||||
|
RemoveButton.enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RemoveButton.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
|
||||||
|
//UpdateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
UpdateView();
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Assets/Controller/WorkerControllerMeat.cs.meta
Normal file
12
Assets/Controller/WorkerControllerMeat.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b60a92ac520037b40981710a2e1564e4
|
||||||
|
timeCreated: 1439478469
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
65
Assets/Controller/WorkerControllerRock.cs
Normal file
65
Assets/Controller/WorkerControllerRock.cs
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class WorkerControllerRock : MonoBehaviour{
|
||||||
|
|
||||||
|
public Text nbWorker;
|
||||||
|
public Text zombieAvailable;
|
||||||
|
public Text nbRessourceExpected;
|
||||||
|
public Button AddButton;
|
||||||
|
public Button RemoveButton;
|
||||||
|
private Stats stats;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public void AddWorker()
|
||||||
|
{
|
||||||
|
stats.removeZombieAvail();
|
||||||
|
stats.NbZombieAssigneRock++;
|
||||||
|
UpdateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LessWorker()
|
||||||
|
{
|
||||||
|
stats.addZombieAvail();
|
||||||
|
stats.NbZombieAssigneRock--;
|
||||||
|
UpdateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateView()
|
||||||
|
{
|
||||||
|
zombieAvailable.text = stats.AmountOfZombiesAvail + "/" + stats.AmountOfZombies;
|
||||||
|
nbRessourceExpected.text = ""+stats.NbOfRockByZombie * stats.NbZombieAssigneRock;
|
||||||
|
nbWorker.text = "" + stats.NbZombieAssigneRock;
|
||||||
|
|
||||||
|
if (stats.AmountOfZombiesAvail <= 0)
|
||||||
|
{
|
||||||
|
AddButton.enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AddButton.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stats.NbZombieAssigneRock <= 0)
|
||||||
|
{
|
||||||
|
RemoveButton.enabled = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RemoveButton.enabled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
UpdateView();
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Assets/Controller/WorkerControllerRock.cs.meta
Normal file
12
Assets/Controller/WorkerControllerRock.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 216990d551e0fb84db8cef4e4191f4e1
|
||||||
|
timeCreated: 1439478047
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -2,7 +2,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
public class WorkerController : MonoBehaviour{
|
public class WorkerControllerWood : MonoBehaviour{
|
||||||
|
|
||||||
public Text nbWorker;
|
public Text nbWorker;
|
||||||
public Text zombieAvailable;
|
public Text zombieAvailable;
|
||||||
@ -11,6 +11,8 @@ public class WorkerController : MonoBehaviour{
|
|||||||
public Button RemoveButton;
|
public Button RemoveButton;
|
||||||
private Stats stats;
|
private Stats stats;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void AddWorker()
|
public void AddWorker()
|
||||||
{
|
{
|
||||||
stats.removeZombieAvail();
|
stats.removeZombieAvail();
|
||||||
@ -53,11 +55,11 @@ public class WorkerController : MonoBehaviour{
|
|||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
|
stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
|
||||||
UpdateView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update () {
|
void Update () {
|
||||||
|
UpdateView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
9
Assets/Prefab.meta
Normal file
9
Assets/Prefab.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 46f9184f2a196ec4e84fb17f672067ef
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1439473277
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ public class Stats : MonoBehaviour
|
|||||||
private int nbZombieAssigneRock;
|
private int nbZombieAssigneRock;
|
||||||
private int nbZombieAssigneCorpse;
|
private int nbZombieAssigneCorpse;
|
||||||
private int nbZombieAssigneMeat;
|
private int nbZombieAssigneMeat;
|
||||||
|
|
||||||
public int NbZombieAssigneMeat
|
public int NbZombieAssigneMeat
|
||||||
{
|
{
|
||||||
get { return nbZombieAssigneMeat;}
|
get { return nbZombieAssigneMeat;}
|
||||||
@ -212,7 +212,7 @@ public class Stats : MonoBehaviour
|
|||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
resetStats(0, 0, 0, 0, 4, 1, 5, 5, 5, 5);
|
resetStats(7, 6, 5, 4, 4, 10, 5, 2, 3, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|||||||
BIN
Assets/Sprite/remove.png
Normal file
BIN
Assets/Sprite/remove.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
55
Assets/Sprite/remove.png.meta
Normal file
55
Assets/Sprite/remove.png.meta
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 263d6aec5af64344295b24f1e866a3b5
|
||||||
|
timeCreated: 1439476949
|
||||||
|
licenseType: Free
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
linearTexture: 0
|
||||||
|
correctGamma: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: .25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 0
|
||||||
|
cubemapConvolution: 0
|
||||||
|
cubemapConvolutionSteps: 8
|
||||||
|
cubemapConvolutionExponent: 1.5
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: -1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapMode: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
rGBM: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: .5, y: .5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
textureType: 8
|
||||||
|
buildTargetSettings: []
|
||||||
|
spriteSheet:
|
||||||
|
sprites: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Sprite/rock.png
Normal file
BIN
Assets/Sprite/rock.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
55
Assets/Sprite/rock.png.meta
Normal file
55
Assets/Sprite/rock.png.meta
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3975a4f7d3a77884e999da66e56c83e5
|
||||||
|
timeCreated: 1439476668
|
||||||
|
licenseType: Free
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
linearTexture: 0
|
||||||
|
correctGamma: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: .25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 0
|
||||||
|
cubemapConvolution: 0
|
||||||
|
cubemapConvolutionSteps: 8
|
||||||
|
cubemapConvolutionExponent: 1.5
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: -1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapMode: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
rGBM: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: .5, y: .5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
textureType: 8
|
||||||
|
buildTargetSettings: []
|
||||||
|
spriteSheet:
|
||||||
|
sprites: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
x
Reference in New Issue
Block a user