This commit is contained in:
Marc-Antoine Dumont 2015-08-13 21:10:30 -04:00
commit 30d6f29f80
14 changed files with 37425 additions and 144 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 69fe9491767156248a652d9f4ad9374a
timeCreated: 1439494353
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dc8046baf857b4140914bf2f53d4740d
timeCreated: 1439493992
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -87,101 +87,47 @@ NavMeshSettings:
cellSize: .166666672 cellSize: .166666672
manualCellSize: 0 manualCellSize: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &433953797 --- !u!1001 &454098392
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 4
m_Component:
- 4: {fileID: 433953799}
- 212: {fileID: 433953798}
m_Layer: 0
m_Name: Bakcground
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &433953798
SpriteRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 433953797}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_Materials:
- {fileID: 10754, guid: 0000000000000000e000000000000000, type: 0}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 1
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: -1
m_Sprite: {fileID: 21300000, guid: 03310a8200613c8458f91f05be6d82d2, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
--- !u!4 &433953799
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 433953797}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
--- !u!1001 &1077754445
Prefab: Prefab:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
m_Modification: m_Modification:
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 0}
m_Modifications: m_Modifications:
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2} - target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -279.655579 value: -67.4717407
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2} - target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: -60.679348 value: 44.3748474
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2} - target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2} - target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2} - target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2} - target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2} - target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2} - target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 2 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: e29ed8143ef4d7246ade0b7422726971, type: 2} m_ParentPrefab: {fileID: 100100000, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
m_IsPrefabParent: 0 m_IsPrefabParent: 0
--- !u!1 &1255384573 --- !u!1 &1255384573
GameObject: GameObject:
@ -268,45 +214,3 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 0 m_RootOrder: 0
--- !u!1001 &1800032770
Prefab:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 443136, guid: c72ab7bf5b2cd13459155c9ea9f6acb1, type: 2}
propertyPath: m_LocalPosition.x
value: 14.4983673
objectReference: {fileID: 0}
- target: {fileID: 443136, guid: c72ab7bf5b2cd13459155c9ea9f6acb1, type: 2}
propertyPath: m_LocalPosition.y
value: 23.5802021
objectReference: {fileID: 0}
- target: {fileID: 443136, guid: c72ab7bf5b2cd13459155c9ea9f6acb1, type: 2}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 443136, guid: c72ab7bf5b2cd13459155c9ea9f6acb1, type: 2}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 443136, guid: c72ab7bf5b2cd13459155c9ea9f6acb1, type: 2}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 443136, guid: c72ab7bf5b2cd13459155c9ea9f6acb1, type: 2}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 443136, guid: c72ab7bf5b2cd13459155c9ea9f6acb1, type: 2}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 443136, guid: c72ab7bf5b2cd13459155c9ea9f6acb1, type: 2}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
m_RemovedComponents: []
m_ParentPrefab: {fileID: 100100000, guid: c72ab7bf5b2cd13459155c9ea9f6acb1, type: 2}
m_IsPrefabParent: 0

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 92407044458d8d84186001acfac6326b guid: adc97c3ddc2c5a949b950160e1b08077
timeCreated: 1439486839 timeCreated: 1439486839
licenseType: Free licenseType: Free
DefaultImporter: DefaultImporter:

10209
Assets/SceneAntoine.unity Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 92407044458d8d84186001acfac6326b
timeCreated: 1439493989
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,33 +3,33 @@ using System.Collections;
public class ConstructionBehaviour : MonoBehaviour { public class ConstructionBehaviour : MonoBehaviour {
public int ConstructionType; public int ConstructionType =-1 ;
public GameObject maisonHumain; public GameObject maisonHumain;
public GameObject maisonZombie; public GameObject maisonZombie;
public GameObject champ;
private GameObject SwitchPrefab; private GameObject SwitchPrefab;
void OnMouseDown() void OnMouseDown()
{ {
if (ConstructionType == -1)
int.TryParse(Input.inputString, out ConstructionType);
switch (ConstructionType) { switch (ConstructionType) {
case 1: case 1:
SwitchPrefab = maisonHumain; SwitchPrefab = maisonHumain;
break; break;
case 2: case 2:
SwitchPrefab = champ;
break;
case 3:
SwitchPrefab = maisonZombie; SwitchPrefab = maisonZombie;
break; break;
default: default:
SwitchPrefab = maisonHumain; SwitchPrefab = null;
break; break;
} }
switchPrefab (); switchPrefab ();
} }
void switchPrefab() void switchPrefab()
{ {
Instantiate (SwitchPrefab, this.gameObject.transform.position, this.gameObject.transform.rotation); if (SwitchPrefab != null) {
DestroyObject (this.gameObject); Instantiate (SwitchPrefab, this.gameObject.transform.position, this.gameObject.transform.rotation);
DestroyObject (this.gameObject);
}
} }
} }

View File

@ -0,0 +1,28 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class HungerScript : MonoBehaviour {
public Slider sliderZombie;
public Slider sliderHumans;
private Stats stats;
// Use this for initialization
void Start()
{
stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
sliderHumans.maxValue = stats.MaxHungerHuman;
sliderZombie.maxValue = stats.MaxHungerZombies;
sliderHumans.value = sliderHumans.maxValue;
sliderZombie.value = sliderZombie.maxValue;
}
// Update is called once per frame
void Update () {
sliderHumans.maxValue = stats.MaxHungerHuman;
sliderZombie.maxValue = stats.MaxHungerZombies;
sliderHumans.value = stats.AmountOfHHunger;
sliderZombie.value = stats.AmountOfZHunger;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ac127753a81f3c64a861325eb9c87672
timeCreated: 1439493965
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -4,10 +4,24 @@ using System;
public class Stats : MonoBehaviour public class Stats : MonoBehaviour
{ {
#region constants
private readonly int HOUSE_SUPPLY_CAP = 10;
private readonly int HUMANS_PER_HOUSE = 2;
private readonly int HUNGER_PER_ZOMBIE = 100;
private readonly int HUNGER_PER_HUMAN = 100;
private readonly int HUNGER_DEDUCT_PER_DAY_H = 25;
private readonly int HUNGER_DEDUCT_PER_DAY_Z = 10;
#endregion
#region attributes #region attributes
private int nbTurns; private int nbTurns;
private int maxHungerHuman;
private int maxHungerZombies;
private int amountOfRock; private int amountOfRock;
private int amountOfWood; private int amountOfWood;
private int amountOfCorpse; private int amountOfCorpse;
@ -53,6 +67,18 @@ public class Stats : MonoBehaviour
set { nbHumanHouses = value; } set { nbHumanHouses = value; }
} }
public int MaxHungerHuman
{
get { return maxHungerHuman; }
set { maxHungerHuman = value; }
}
public int MaxHungerZombies
{
get { return maxHungerZombies; }
set { maxHungerZombies = value; }
}
public int AmountZombieHouse public int AmountZombieHouse
{ {
get { return nbZombieHouses; } get { return nbZombieHouses; }
@ -240,10 +266,11 @@ public class Stats : MonoBehaviour
} }
#endregion #endregion
/*
public Stats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies) 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); 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, public void resetStats(int nbRock, int nbWood, int nbCorpse, int nbMeat, int nbHumans, int nbZombies,
int nbOfWoodByZombie, int nbOfRockByZombie, int nbOfMeatByZombie, int nbOfCorpseByZombie) int nbOfWoodByZombie, int nbOfRockByZombie, int nbOfMeatByZombie, int nbOfCorpseByZombie)
@ -262,8 +289,13 @@ public class Stats : MonoBehaviour
NbZombieAssigneRock = 0; NbZombieAssigneRock = 0;
NbZombieAssigneCorpse = 0; NbZombieAssigneCorpse = 0;
AmountOfZombiesAvail = AmountOfZombies; AmountOfZombiesAvail = AmountOfZombies;
AmountOfHHunger = 250 * AmountOfHumans;
AmountOfZHunger = 500 * AmountOfZombies;
//Init Hunger
setMaxHungerHumans();
setMaxHungerZombies();
AmountOfHHunger = maxHungerHuman;
AmountOfZHunger = MaxHungerZombies;
} }
private void applyStatModifications() private void applyStatModifications()
@ -276,12 +308,12 @@ public class Stats : MonoBehaviour
private void advanceTurn() private void advanceTurn()
{ {
nbTurns++; NbTurns++;
} }
private bool isHumanMaxCapacity() private bool isHumanMaxCapacity()
{ {
int cap = nbHumanHouses * 10; int cap = nbHumanHouses * HOUSE_SUPPLY_CAP;
if (AmountOfHumans > cap) if (AmountOfHumans > cap)
return true; return true;
else else
@ -290,7 +322,7 @@ public class Stats : MonoBehaviour
private bool isZombieMaxCapacity() private bool isZombieMaxCapacity()
{ {
int cap = nbZombieHouses * 10; int cap = nbZombieHouses * HOUSE_SUPPLY_CAP;
if (AmountOfZombies > cap) if (AmountOfZombies > cap)
return true; return true;
else else
@ -300,9 +332,9 @@ public class Stats : MonoBehaviour
public void endTurn() public void endTurn()
{ {
if (!isHumanMaxCapacity()) if (!isHumanMaxCapacity())
AmountOfHumans += (2 * AmountHumanHouse); //AmountOfHumans += (HUMANS_PER_HOUSE * AmountHumanHouse);
if (isZombieMaxCapacity()) if (isZombieMaxCapacity())
AmountOfZombies -= AmountOfZombies % (AmountZombieHouse * 10); //AmountOfZombies -= AmountOfZombies % (AmountZombieHouse * HOUSE_SUPPLY_CAP);
applyStatModifications(); applyStatModifications();
calculateHunger(); calculateHunger();
advanceTurn(); advanceTurn();
@ -310,8 +342,18 @@ public class Stats : MonoBehaviour
private void calculateHunger() private void calculateHunger()
{ {
AmountOfHHunger -= 10 * AmountOfHumans; AmountOfHHunger -= HUNGER_DEDUCT_PER_DAY_H * AmountOfHumans;
AmountOfZHunger -= 50 * AmountOfZombies; AmountOfZHunger -= HUNGER_DEDUCT_PER_DAY_Z * AmountOfZombies;
}
private void setMaxHungerHumans()
{
MaxHungerHuman = AmountOfHumans * HUNGER_PER_HUMAN;
}
private void setMaxHungerZombies()
{
MaxHungerZombies = AmountOfZombies * HUNGER_PER_ZOMBIE;
} }
public String displayStats() public String displayStats()
@ -352,7 +394,7 @@ public class Stats : MonoBehaviour
// Use this for initialization // Use this for initialization
void Start () { void Start () {
resetStats(3, 6, 7, 8, 4, 1, 5, 5, 5, 5); resetStats(3, 6, 7, 8, 4, 1, 1, 5, 5, 5);
} }
// Update is called once per frame // Update is called once per frame