cleaned project, added death stats
This commit is contained in:
@@ -142,6 +142,7 @@ public class Controls : MonoBehaviour
|
||||
break;
|
||||
case "Tree":
|
||||
StartCoroutine(playAnimation(target, "Chopping"));
|
||||
player.GetComponent<PlayerGameObject>().getPlayer().getStat("TreeCount").changeAmount(1);
|
||||
GameObject.Find("Inventory").GetComponent<Inventory>().addItem(new Item("Wood"));
|
||||
break;
|
||||
case "Stone":
|
||||
@@ -174,6 +175,7 @@ public class Controls : MonoBehaviour
|
||||
{
|
||||
GameObject.Find("Inventory").GetComponent<Inventory>().addItem(new Item("Tin ore"));
|
||||
}
|
||||
player.GetComponent<PlayerGameObject>().getPlayer().getStat("OreCount").changeAmount(1);
|
||||
StartCoroutine(playAnimation(target, "Mining"));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -311,6 +311,27 @@ namespace Assets.Scripts
|
||||
public void showDeathScreen()
|
||||
{
|
||||
state = UIState.DEATH;
|
||||
|
||||
PlayerObject player = GameObject.Find("Player").GetComponent<PlayerGameObject>().getPlayer();
|
||||
GameObject statText = GameObject.Find("txtDeathStats");
|
||||
string text = statText.GetComponent<Text>().text;
|
||||
|
||||
text = text.Replace("NAME", player.getPlayerName());
|
||||
text = text.Replace("RACE", player.getRace().racename);
|
||||
text = text.Replace("CLASS", player.getClass().classname);
|
||||
text = text.Replace("LEVEL", player.getStat("Level").getAmount().ToString());
|
||||
text = text.Replace("KILLS", player.getStat("Killcount").getAmount().ToString());
|
||||
text = text.Replace("HEALTH", player.getStat("MaxHealth").getAmount().ToString());
|
||||
text = text.Replace("SECONDARY", player.getStat("MaxSecondary").getAmount().ToString());
|
||||
text = text.Replace("INT", player.getStat("Intelligence").getAmount().ToString());
|
||||
text = text.Replace("STR", player.getStat("Strength").getAmount().ToString());
|
||||
text = text.Replace("DEX", player.getStat("Dexterity").getAmount().ToString());
|
||||
text = text.Replace("TREES", player.getStat("TreeCount").getAmount().ToString());
|
||||
text = text.Replace("ORES", player.getStat("OreCount").getAmount().ToString());
|
||||
text = text.Replace("DIFFICULTY", player.getDifficulty() == 0 ? "Easy" : player.getDifficulty() == 1 ? "Normal" : "Hard");
|
||||
|
||||
statText.GetComponent<Text>().text = text;
|
||||
|
||||
hideOtherElements(deathscreen);
|
||||
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnMenu"));
|
||||
}
|
||||
|
||||
@@ -51,15 +51,26 @@ namespace Assets.Scripts.Player
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (player.getStat("Killcount").getAmount() != -1)
|
||||
if (player.getStat("Killcount").getAmount() == -1)
|
||||
{
|
||||
getRotation();
|
||||
regeneratePlayer();
|
||||
uihandler.adjustInformation(this);
|
||||
if (!finishedGame)
|
||||
{
|
||||
gameFinished();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(uihandler.state == UIState.DEATH){
|
||||
return;
|
||||
}
|
||||
|
||||
getRotation();
|
||||
regeneratePlayer();
|
||||
uihandler.adjustInformation(this);
|
||||
if (!finishedGame)
|
||||
{
|
||||
gameFinished();
|
||||
}
|
||||
if (player.isDead())
|
||||
{
|
||||
SteamWorksHandler.getStandardAchievement("DeathAchievement");
|
||||
uihandler.showDeathScreen();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +88,7 @@ namespace Assets.Scripts.Player
|
||||
{
|
||||
now = DateTime.Now;
|
||||
player.regainSecondary(inventory.getEquipmentBonus()["MPR"], inventory.getEquipmentBonus()["MP"]);
|
||||
player.healPlayer(4 - difficulty * 2, inventory.getEquipmentBonus()["HP"]);
|
||||
player.healPlayer(/*4 - difficulty * 2*/-20, inventory.getEquipmentBonus()["HP"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace Assets.Scripts.Player
|
||||
stats.Add("Luck", new PlayerStat("Luck", 20 - (difficulty * 5), "The current luck of the player"));
|
||||
stats.Add("Killcount", new PlayerStat("Killcount", -1, "The current killcount of the player"));
|
||||
stats.Add("Points", new PlayerStat("Points", 0, "The current skillpoints of the player"));
|
||||
stats.Add("TreeCount", new PlayerStat("TreeCount",0,"The amount of trees the player chopped"));
|
||||
stats.Add("OreCount", new PlayerStat("OreCount",0,"The amount of ores the player mined"));
|
||||
|
||||
if (!isLoad)
|
||||
{
|
||||
@@ -108,6 +110,8 @@ namespace Assets.Scripts.Player
|
||||
stats["Luck"].setAmount((int)json["luck"]);
|
||||
stats["SecondaryRegen"].setAmount((int)json["secondaryRegen"]);
|
||||
stats["Killcount"].setAmount((int)json["killcount"]);
|
||||
stats["TreeCount"].setAmount((int)json["treecount"]);
|
||||
stats["OreCount"].setAmount((int)json["orecount"]);
|
||||
|
||||
loadRole(json["role"].ToString());
|
||||
loadRace(json["race"].ToString());
|
||||
@@ -283,7 +287,7 @@ namespace Assets.Scripts.Player
|
||||
|
||||
if (amount <= 0 || EasterEggHandler.isGodMode(this))
|
||||
{
|
||||
return stats["Health"].getAmount() <= 0;
|
||||
return isDead();
|
||||
}
|
||||
|
||||
if (isDodging)
|
||||
@@ -298,6 +302,10 @@ namespace Assets.Scripts.Player
|
||||
stats["Health"].changeAmount(-amount);
|
||||
}
|
||||
}
|
||||
return isDead();
|
||||
}
|
||||
|
||||
public bool isDead(){
|
||||
return stats["Health"].getAmount() <= 0;
|
||||
}
|
||||
|
||||
@@ -369,6 +377,8 @@ namespace Assets.Scripts.Player
|
||||
result = result + FileHandler.generateJSON("secondaryRegen", stats["SecondaryRegen"].getAmount()) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("isDodging", "\"" + isDodging + "\"") + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("killcount", stats["Killcount"].getAmount()) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("treecount", stats["TreeCount"].getAmount()) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("orecount", stats["OreCount"].getAmount()) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("luck", stats["Luck"].getAmount()) + ",\r\n";
|
||||
result = result + FileHandler.generateJSON("difficulty", difficulty);
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user