Panel for ressource work.

This commit is contained in:
Marc-Antoine Dumont 2015-08-13 12:06:18 -04:00
parent f1d0093b5d
commit d71e178ce6
13 changed files with 4907 additions and 426 deletions

View 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();
}
}

View 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:

View 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();
}
}

View 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:

View File

@ -2,7 +2,7 @@
using System.Collections;
using UnityEngine.UI;
public class WorkerController : MonoBehaviour{
public class WorkerControllerWood : MonoBehaviour{
public Text nbWorker;
public Text zombieAvailable;
@ -11,6 +11,8 @@ public class WorkerController : MonoBehaviour{
public Button RemoveButton;
private Stats stats;
public void AddWorker()
{
stats.removeZombieAvail();
@ -53,11 +55,11 @@ public class WorkerController : MonoBehaviour{
// Use this for initialization
void Start () {
stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
UpdateView();
}
// Update is called once per frame
void Update () {
UpdateView();
}
}

9
Assets/Prefab.meta Normal file
View 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

View File

@ -212,7 +212,7 @@ public class Stats : MonoBehaviour
// Use this for initialization
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

BIN
Assets/Sprite/remove.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View 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: