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
92a3f7b270
File diff suppressed because it is too large
Load Diff
23
Assets/Script/ConfirmStatsScript.cs
Normal file
23
Assets/Script/ConfirmStatsScript.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using System.Collections;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class ConfirmStatsScript : MonoBehaviour {
|
||||||
|
|
||||||
|
public Text currentValues;
|
||||||
|
public Text addedValues;
|
||||||
|
public Text alertTitle;
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
Stats stats = GameObject.Find("Stats").gameObject.GetComponent<Stats>();
|
||||||
|
currentValues.text = stats.displayCurrentStats();
|
||||||
|
addedValues.text = stats.displayAddingStats();
|
||||||
|
alertTitle.text = "DAY " + stats.NbTurns;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update is called once per frame
|
||||||
|
void Update () {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
12
Assets/Script/ConfirmStatsScript.cs.meta
Normal file
12
Assets/Script/ConfirmStatsScript.cs.meta
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c11185c2efdb07f4ea21f9c01b32dedb
|
||||||
|
timeCreated: 1439482178
|
||||||
|
licenseType: Free
|
||||||
|
MonoImporter:
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -1,9 +1,13 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
using System;
|
||||||
|
|
||||||
public class Stats : MonoBehaviour
|
public class Stats : MonoBehaviour
|
||||||
{
|
{
|
||||||
#region attributes
|
#region attributes
|
||||||
|
|
||||||
|
private int nbTurns;
|
||||||
|
|
||||||
private int amountOfRock;
|
private int amountOfRock;
|
||||||
private int amountOfWood;
|
private int amountOfWood;
|
||||||
private int amountOfCorpse;
|
private int amountOfCorpse;
|
||||||
@ -23,7 +27,37 @@ public class Stats : MonoBehaviour
|
|||||||
private int nbZombieAssigneCorpse;
|
private int nbZombieAssigneCorpse;
|
||||||
private int nbZombieAssigneMeat;
|
private int nbZombieAssigneMeat;
|
||||||
|
|
||||||
public int NbZombieAssigneMeat
|
private int nbHumanHouses;
|
||||||
|
private int nbZombieHouses;
|
||||||
|
|
||||||
|
private int humanHunger;
|
||||||
|
private int zombieHunger;
|
||||||
|
|
||||||
|
public int AmountOfZHunger
|
||||||
|
{
|
||||||
|
get { return zombieHunger; }
|
||||||
|
set { zombieHunger = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int AmountOfHHunger
|
||||||
|
{
|
||||||
|
get { return humanHunger; }
|
||||||
|
set { humanHunger = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int AmountHumanHouse
|
||||||
|
{
|
||||||
|
get { return nbHumanHouses; }
|
||||||
|
set { nbHumanHouses = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int AmountZombieHouse
|
||||||
|
{
|
||||||
|
get { return nbZombieHouses; }
|
||||||
|
set { nbZombieHouses = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public int NbZombieAssigneMeat
|
||||||
{
|
{
|
||||||
get { return nbZombieAssigneMeat;}
|
get { return nbZombieAssigneMeat;}
|
||||||
set { nbZombieAssigneMeat = value;}
|
set { nbZombieAssigneMeat = value;}
|
||||||
@ -112,6 +146,11 @@ public class Stats : MonoBehaviour
|
|||||||
set { amountOfZombiesAvail = value; }
|
set { amountOfZombiesAvail = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int NbTurns
|
||||||
|
{
|
||||||
|
get { return nbTurns; }
|
||||||
|
set { nbTurns = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public void addCorpse()
|
public void addCorpse()
|
||||||
{
|
{
|
||||||
@ -184,7 +223,6 @@ 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);
|
||||||
@ -208,11 +246,97 @@ public class Stats : MonoBehaviour
|
|||||||
NbZombieAssigneCorpse = 0;
|
NbZombieAssigneCorpse = 0;
|
||||||
NbZombieAssigneMeat = 0;
|
NbZombieAssigneMeat = 0;
|
||||||
AmountOfZombiesAvail = AmountOfZombies;
|
AmountOfZombiesAvail = AmountOfZombies;
|
||||||
|
AmountOfHHunger = 250 * AmountOfHumans;
|
||||||
|
AmountOfZHunger = 500 * AmountOfZombies;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use this for initialization
|
private void applyStatModifications()
|
||||||
void Start () {
|
{
|
||||||
resetStats(7, 6, 5, 4, 4, 10, 5, 2, 3, 1);
|
AmountOfCorpse += (NbZombieAssigneCorpse * NbOfCorpseByZombie);
|
||||||
|
AmountOfMeat += (NbZombieAssigneMeat * NbOfMeatByZombie);
|
||||||
|
AmountOfRock += (NbZombieAssigneRock * NbOfRockByZombie);
|
||||||
|
AmountOfWood += (NbZombieAssigneWood * NbOfWoodByZombie);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void advanceTurn()
|
||||||
|
{
|
||||||
|
nbTurns++;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isHumanMaxCapacity()
|
||||||
|
{
|
||||||
|
int cap = nbHumanHouses * 10;
|
||||||
|
if (AmountOfHumans > cap)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isZombieMaxCapacity()
|
||||||
|
{
|
||||||
|
int cap = nbZombieHouses * 10;
|
||||||
|
if (AmountOfZombies > cap)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void endTurn()
|
||||||
|
{
|
||||||
|
if (!isHumanMaxCapacity())
|
||||||
|
AmountOfHumans += (2 * AmountHumanHouse);
|
||||||
|
if (isZombieMaxCapacity())
|
||||||
|
AmountOfZombies -= AmountOfZombies % (AmountZombieHouse * 10);
|
||||||
|
applyStatModifications();
|
||||||
|
calculateHunger();
|
||||||
|
advanceTurn();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculateHunger()
|
||||||
|
{
|
||||||
|
AmountOfHHunger -= 10 * AmountOfHumans;
|
||||||
|
AmountOfZHunger -= 50 * AmountOfZombies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String displayStats()
|
||||||
|
{
|
||||||
|
//TODO: Needs completion and formatting
|
||||||
|
String body = "";
|
||||||
|
body += "Wood: " + AmountOfWood + "\n";
|
||||||
|
body += "Meat: " + AmountOfMeat + "\n";
|
||||||
|
body += "Corpses: " + AmountOfCorpse + "\n";
|
||||||
|
body += "Rock: " + AmountOfRock + "\n";
|
||||||
|
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String displayAddingStats()
|
||||||
|
{
|
||||||
|
//TODO: Needs completion and formatting
|
||||||
|
String body = "";
|
||||||
|
body += "+" + NbZombieAssigneWood * NbOfWoodByZombie + "\n" + "\n";
|
||||||
|
body += "+" + NbZombieAssigneRock * NbOfRockByZombie + "\n" + "\n";
|
||||||
|
body += "+" + NbZombieAssigneMeat * NbOfMeatByZombie + "\n" + "\n";
|
||||||
|
body += "+" + NbZombieAssigneCorpse * NbOfCorpseByZombie + "\n" + "\n";
|
||||||
|
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String displayCurrentStats()
|
||||||
|
{
|
||||||
|
String body = "";
|
||||||
|
body += AmountOfWood + "\n" + "\n";
|
||||||
|
body += AmountOfRock + "\n" + "\n";
|
||||||
|
body += AmountOfMeat + "\n" + "\n";
|
||||||
|
body += AmountOfCorpse + "\n" + "\n";
|
||||||
|
|
||||||
|
return body;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use this for initialization
|
||||||
|
void Start () {
|
||||||
|
resetStats(3, 6, 7, 8, 4, 1, 5, 5, 5, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user