mirror of
https://github.com/ConjureETS/Human-Farm-Tycoon.git
synced 2026-03-24 02:11:07 +00:00
Merge branch 'master' of https://github.com/ConjureETS/Human-Farm-Tycoon
This commit is contained in:
commit
30d6f29f80
File diff suppressed because it is too large
Load Diff
9815
Assets/Prefabs/Gameworld.prefab
Normal file
9815
Assets/Prefabs/Gameworld.prefab
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/Prefabs/Gameworld.prefab.meta
Normal file
8
Assets/Prefabs/Gameworld.prefab.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69fe9491767156248a652d9f4ad9374a
|
||||
timeCreated: 1439494353
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
6613
Assets/Scene/AntoineScene.unity
Normal file
6613
Assets/Scene/AntoineScene.unity
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/Scene/AntoineScene.unity.meta
Normal file
8
Assets/Scene/AntoineScene.unity.meta
Normal 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
@ -87,101 +87,47 @@ NavMeshSettings:
|
||||
cellSize: .166666672
|
||||
manualCellSize: 0
|
||||
m_NavMeshData: {fileID: 0}
|
||||
--- !u!1 &433953797
|
||||
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
|
||||
--- !u!1001 &454098392
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2}
|
||||
- target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -279.655579
|
||||
value: -67.4717407
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2}
|
||||
- target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: -60.679348
|
||||
value: 44.3748474
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2}
|
||||
- target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2}
|
||||
- target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2}
|
||||
- target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2}
|
||||
- target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2}
|
||||
- target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 494730, guid: e29ed8143ef4d7246ade0b7422726971, type: 2}
|
||||
- target: {fileID: 460810, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: e29ed8143ef4d7246ade0b7422726971, type: 2}
|
||||
m_ParentPrefab: {fileID: 100100000, guid: 69fe9491767156248a652d9f4ad9374a, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
--- !u!1 &1255384573
|
||||
GameObject:
|
||||
@ -268,45 +214,3 @@ Transform:
|
||||
m_Children: []
|
||||
m_Father: {fileID: 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
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92407044458d8d84186001acfac6326b
|
||||
guid: adc97c3ddc2c5a949b950160e1b08077
|
||||
timeCreated: 1439486839
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
|
||||
10209
Assets/SceneAntoine.unity
Normal file
10209
Assets/SceneAntoine.unity
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/SceneAntoine.unity.meta
Normal file
8
Assets/SceneAntoine.unity.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 92407044458d8d84186001acfac6326b
|
||||
timeCreated: 1439493989
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -3,33 +3,33 @@ using System.Collections;
|
||||
|
||||
public class ConstructionBehaviour : MonoBehaviour {
|
||||
|
||||
public int ConstructionType;
|
||||
public int ConstructionType =-1 ;
|
||||
public GameObject maisonHumain;
|
||||
public GameObject maisonZombie;
|
||||
public GameObject champ;
|
||||
private GameObject SwitchPrefab;
|
||||
|
||||
void OnMouseDown()
|
||||
{
|
||||
if (ConstructionType == -1)
|
||||
int.TryParse(Input.inputString, out ConstructionType);
|
||||
switch (ConstructionType) {
|
||||
case 1:
|
||||
SwitchPrefab = maisonHumain;
|
||||
break;
|
||||
case 2:
|
||||
SwitchPrefab = champ;
|
||||
break;
|
||||
case 3:
|
||||
SwitchPrefab = maisonZombie;
|
||||
break;
|
||||
default:
|
||||
SwitchPrefab = maisonHumain;
|
||||
SwitchPrefab = null;
|
||||
break;
|
||||
}
|
||||
switchPrefab ();
|
||||
}
|
||||
void switchPrefab()
|
||||
{
|
||||
if (SwitchPrefab != null) {
|
||||
Instantiate (SwitchPrefab, this.gameObject.transform.position, this.gameObject.transform.rotation);
|
||||
DestroyObject (this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
28
Assets/Script/HungerScript.cs
Normal file
28
Assets/Script/HungerScript.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
12
Assets/Script/HungerScript.cs.meta
Normal file
12
Assets/Script/HungerScript.cs.meta
Normal 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:
|
||||
@ -4,10 +4,24 @@ using System;
|
||||
|
||||
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
|
||||
|
||||
private int nbTurns;
|
||||
|
||||
private int maxHungerHuman;
|
||||
private int maxHungerZombies;
|
||||
|
||||
private int amountOfRock;
|
||||
private int amountOfWood;
|
||||
private int amountOfCorpse;
|
||||
@ -53,6 +67,18 @@ public class Stats : MonoBehaviour
|
||||
set { nbHumanHouses = value; }
|
||||
}
|
||||
|
||||
public int MaxHungerHuman
|
||||
{
|
||||
get { return maxHungerHuman; }
|
||||
set { maxHungerHuman = value; }
|
||||
}
|
||||
|
||||
public int MaxHungerZombies
|
||||
{
|
||||
get { return maxHungerZombies; }
|
||||
set { maxHungerZombies = value; }
|
||||
}
|
||||
|
||||
public int AmountZombieHouse
|
||||
{
|
||||
get { return nbZombieHouses; }
|
||||
@ -240,10 +266,11 @@ public class Stats : MonoBehaviour
|
||||
}
|
||||
#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)
|
||||
@ -262,8 +289,13 @@ public class Stats : MonoBehaviour
|
||||
NbZombieAssigneRock = 0;
|
||||
NbZombieAssigneCorpse = 0;
|
||||
AmountOfZombiesAvail = AmountOfZombies;
|
||||
AmountOfHHunger = 250 * AmountOfHumans;
|
||||
AmountOfZHunger = 500 * AmountOfZombies;
|
||||
|
||||
|
||||
//Init Hunger
|
||||
setMaxHungerHumans();
|
||||
setMaxHungerZombies();
|
||||
AmountOfHHunger = maxHungerHuman;
|
||||
AmountOfZHunger = MaxHungerZombies;
|
||||
}
|
||||
|
||||
private void applyStatModifications()
|
||||
@ -276,12 +308,12 @@ public class Stats : MonoBehaviour
|
||||
|
||||
private void advanceTurn()
|
||||
{
|
||||
nbTurns++;
|
||||
NbTurns++;
|
||||
}
|
||||
|
||||
private bool isHumanMaxCapacity()
|
||||
{
|
||||
int cap = nbHumanHouses * 10;
|
||||
int cap = nbHumanHouses * HOUSE_SUPPLY_CAP;
|
||||
if (AmountOfHumans > cap)
|
||||
return true;
|
||||
else
|
||||
@ -290,7 +322,7 @@ public class Stats : MonoBehaviour
|
||||
|
||||
private bool isZombieMaxCapacity()
|
||||
{
|
||||
int cap = nbZombieHouses * 10;
|
||||
int cap = nbZombieHouses * HOUSE_SUPPLY_CAP;
|
||||
if (AmountOfZombies > cap)
|
||||
return true;
|
||||
else
|
||||
@ -300,9 +332,9 @@ public class Stats : MonoBehaviour
|
||||
public void endTurn()
|
||||
{
|
||||
if (!isHumanMaxCapacity())
|
||||
AmountOfHumans += (2 * AmountHumanHouse);
|
||||
//AmountOfHumans += (HUMANS_PER_HOUSE * AmountHumanHouse);
|
||||
if (isZombieMaxCapacity())
|
||||
AmountOfZombies -= AmountOfZombies % (AmountZombieHouse * 10);
|
||||
//AmountOfZombies -= AmountOfZombies % (AmountZombieHouse * HOUSE_SUPPLY_CAP);
|
||||
applyStatModifications();
|
||||
calculateHunger();
|
||||
advanceTurn();
|
||||
@ -310,8 +342,18 @@ public class Stats : MonoBehaviour
|
||||
|
||||
private void calculateHunger()
|
||||
{
|
||||
AmountOfHHunger -= 10 * AmountOfHumans;
|
||||
AmountOfZHunger -= 50 * AmountOfZombies;
|
||||
AmountOfHHunger -= HUNGER_DEDUCT_PER_DAY_H * AmountOfHumans;
|
||||
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()
|
||||
@ -352,7 +394,7 @@ public class Stats : MonoBehaviour
|
||||
|
||||
// Use this for initialization
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user