This commit is contained in:
unknown 2015-08-13 13:39:57 -04:00
commit 29352dba1b
14 changed files with 5353 additions and 76 deletions

View File

@ -1,39 +0,0 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class WorkerController : MonoBehaviour{
public Text nbWorker;
public Text zombieAvailable;
public Text nbRessourceExpected;
private Stats stats;
public void AddWorker()
{
stats.AmountOfZombiesAvail --;
UpdateView();
}
public void LessWorker()
{
stats.AmountOfZombiesAvail ++;
UpdateView();
}
public void UpdateView()
{
zombieAvailable.text = stats.AmountOfZombiesAvail + "/" + stats.AmountOfZombies;
}
// Use this for initialization
void Start () {
Stats stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
}
// Update is called once per frame
void Update () {
}
}

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

@ -0,0 +1,65 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class WorkerControllerWood : 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.NbZombieAssigneWood++;
UpdateView();
}
public void LessWorker()
{
stats.addZombieAvail();
stats.NbZombieAssigneWood--;
UpdateView();
}
private void UpdateView()
{
zombieAvailable.text = stats.AmountOfZombiesAvail + "/" + stats.AmountOfZombies;
nbRessourceExpected.text = ""+stats.NbOfWoodByZombie * stats.NbZombieAssigneWood;
nbWorker.text = ""+stats.NbZombieAssigneWood;
if (stats.AmountOfZombiesAvail <= 0)
{
AddButton.enabled = false;
}
else
{
AddButton.enabled = true;
}
if (stats.NbZombieAssigneWood <= 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();
}
}

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

@ -1,8 +1,9 @@
using UnityEngine; using UnityEngine;
using System.Collections; using System.Collections;
public class Stats : MonoBehaviour { public class Stats : MonoBehaviour
{
#region attributes
private int amountOfRock; private int amountOfRock;
private int amountOfWood; private int amountOfWood;
private int amountOfCorpse; private int amountOfCorpse;
@ -12,6 +13,64 @@ public class Stats : MonoBehaviour {
private int amountOfHumans; private int amountOfHumans;
private int amountOfZombiesAvail; private int amountOfZombiesAvail;
private int nbOfWoodByZombie;
private int nbOfRockByZombie;
private int nbOfMeatByZombie;
private int nbOfCorpseByZombie;
private int nbZombieAssigneWood;
private int nbZombieAssigneRock;
private int nbZombieAssigneCorpse;
private int nbZombieAssigneMeat;
public int NbZombieAssigneMeat
{
get { return nbZombieAssigneMeat;}
set { nbZombieAssigneMeat = value;}
}
public int NbZombieAssigneCorpse
{
get { return nbZombieAssigneCorpse;}
set { nbZombieAssigneCorpse = value;}
}
public int NbZombieAssigneRock
{
get { return nbZombieAssigneRock; }
set { nbZombieAssigneRock = value; }
}
public int NbZombieAssigneWood
{
get { return nbZombieAssigneWood; }
set { nbZombieAssigneWood = value; }
}
public int NbOfCorpseByZombie
{
get { return nbOfCorpseByZombie; }
set { nbOfCorpseByZombie = value; }
}
public int NbOfMeatByZombie
{
get { return nbOfMeatByZombie; }
set { nbOfMeatByZombie = value; }
}
public int NbOfRockByZombie
{
get { return nbOfRockByZombie; }
set { nbOfRockByZombie = value; }
}
public int NbOfWoodByZombie
{
get { return nbOfWoodByZombie; }
set { nbOfWoodByZombie = value; }
}
public int AmountOfMeat public int AmountOfMeat
{ {
get { return amountOfMeat; } get { return amountOfMeat; }
@ -41,7 +100,6 @@ public class Stats : MonoBehaviour {
get { return amountOfZombies; } get { return amountOfZombies; }
set { amountOfZombies = value; } set { amountOfZombies = value; }
} }
public int AmountOfHumans public int AmountOfHumans
{ {
get { return amountOfHumans; } get { return amountOfHumans; }
@ -54,20 +112,6 @@ public class Stats : MonoBehaviour {
set { amountOfZombiesAvail = value; } set { amountOfZombiesAvail = value; }
} }
public Stats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies)
{
resetStats(nbRock, nbWood, nbCorpse, nbMeat, nbHumans, nbZombies);
}
public void resetStats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies)
{
AmountOfCorpse = nbCorpse;
AmountOfMeat = nbMeat;
AmountOfRock = nbRock;
AmountOfWood = nbWood;
AmountOfHumans = nbHumans;
AmountOfZombies = nbZombies;
}
public void addCorpse() public void addCorpse()
{ {
@ -138,10 +182,37 @@ public class Stats : MonoBehaviour {
{ {
amountOfZombiesAvail--; amountOfZombiesAvail--;
} }
#endregion
public Stats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies)
{
resetStats(nbRock, nbWood, nbCorpse, nbMeat, nbHumans, nbZombies, 5, 5, 5, 5);
}
public void resetStats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies,
int nbOfWoodByZombie, int nbOfRockByZombie, int nbOfMeatByZombie, int nbOfCorpseByZombie)
{
AmountOfCorpse = nbCorpse;
AmountOfMeat = nbMeat;
AmountOfRock = nbRock;
AmountOfWood = nbWood;
AmountOfHumans = nbHumans;
AmountOfZombies = nbZombies;
NbOfCorpseByZombie = nbOfCorpseByZombie;
NbOfMeatByZombie = nbOfMeatByZombie;
NbOfRockByZombie = nbOfRockByZombie;
NbOfWoodByZombie = nbOfWoodByZombie;
NbZombieAssigneWood = 0;
NbZombieAssigneRock = 0;
NbZombieAssigneCorpse = 0;
NbZombieAssigneMeat = 0;
AmountOfZombiesAvail = AmountOfZombies;
}
// Use this for initialization // Use this for initialization
void Start () { void Start () {
resetStats(0, 0, 0, 0, 4, 1); 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

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: