//TIRA ENERGIA DAQ public void Button_lab() { fileName = lastMonster + ".json"; string str = Read(); JSONNode json = JSON.Parse(str); int energy; energy = int.Parse(json["energy"]); energy -= 10; Debug.Log("Mamute.json do not exist"); int _damage = Mathf.RoundToInt(total_damage); int _health = Mathf.RoundToInt(total_health); int _resistance = Mathf.RoundToInt(total_resistance); int _energy = Mathf.RoundToInt(total_energy); int _toxi = 0; _energy = energy; int _total_damage = Mathf.RoundToInt(total_damage); int _total_health = Mathf.RoundToInt(total_health); int _total_resistance = Mathf.RoundToInt(total_resistance); int _total_energy = Mathf.RoundToInt(total_energy); level = 1; Monster_Create Monster_Create; Monster_Create = new Monster_Create(_total_damage, _total_health, _total_resistance, _total_energy, _damage, _health, _resistance, level, _energy, _toxi); playerJson = JsonMapper.ToJson(Monster_Create); //File.WriteAllText(Application.dataPath + "/lastMonster.json", playerJson.ToString()); File.WriteAllText((Application.persistentDataPath + "/" + lastMonster + ".json"), playerJson.ToString()); Application.LoadLevel("MonstersAdm"); }
public void Inject() { if (LastMonster == "Aguia") { MenuStatus.GetComponent <StatsBehaviour> ().AguiaValues(); } else if (LastMonster == "Mamute") { MenuStatus.GetComponent <StatsBehaviour> ().MamuteValues(); } else if (LastMonster == "Peixe") { MenuStatus.GetComponent <StatsBehaviour>().PeixeValues(); } if (ItemSelect == "item1") { itensbehaviour.item1 -= 1; tmpEner = 50; tmpForca = 0; tmpResis = 0; tmpConst = 0; tmpTox = 5; tmpVida = 0; } else if (ItemSelect == "item2") { itensbehaviour.item2 -= 1; tmpEner = 50; tmpForca = 1; tmpResis = 3; tmpConst = 0; tmpTox = 40; tmpVida = 0; } else if (ItemSelect == "item3") { itensbehaviour.item3 -= 1; tmpEner = 0; tmpForca = 1; tmpResis = 3; tmpConst = 0; tmpTox = 0; tmpVida = 5; } else if (ItemSelect == "item4") { itensbehaviour.item4 -= 1; tmpEner = 0; tmpForca = 0; tmpResis = 0; tmpConst = 0; tmpTox = -20; tmpVida = 0; } else if (ItemSelect == "item5") { itensbehaviour.item5 -= 1; tmpEner = 0; tmpForca = 0; tmpResis = 0; tmpConst = 0; tmpTox = 10; tmpVida = 20; } else if (ItemSelect == "item6") { itensbehaviour.item6 -= 1; tmpEner = 0; tmpForca = 5; tmpResis = 0; tmpConst = 1; tmpTox = 70; tmpVida = 0; } int damage = MenuStatus.GetComponent <StatsBehaviour>().forc + tmpForca; int health = MenuStatus.GetComponent <StatsBehaviour>().cons + tmpConst; int resistance = MenuStatus.GetComponent <StatsBehaviour>().resis + tmpResis;; int energy = MenuStatus.GetComponent <StatsBehaviour>().ener + tmpEner; int toxi = MenuStatus.GetComponent <StatsBehaviour>().tox + tmpTox; int level = MenuStatus.GetComponent <StatsBehaviour> ().level; int total_damage = damage; int total_health = MenuStatus.GetComponent <StatsBehaviour>().vida; int total_resistance = resistance; int total_energy = energy; savechanges = new Monster_Create(total_damage, total_health, total_resistance, total_energy, damage, health, resistance, level, energy, toxi); playerJson = JsonMapper.ToJson(savechanges); if (LastMonster == "Aguia") { File.WriteAllText((Application.persistentDataPath + "/Aguia.json"), playerJson.ToString()); } else if (LastMonster == "Mamute") { File.WriteAllText((Application.persistentDataPath + "/Mamute.json"), playerJson.ToString()); } else if (LastMonster == "Peixe") { File.WriteAllText((Application.persistentDataPath + "/Peixe.json"), playerJson.ToString()); } itenssave = new Itens(itensbehaviour.item1, itensbehaviour.item2, itensbehaviour.item3, itensbehaviour.item4, itensbehaviour.item5, itensbehaviour.item6); playerJson = JsonMapper.ToJson(itenssave); File.WriteAllText((Application.persistentDataPath + "/Itens.json"), playerJson.ToString()); CollidersEnable(btnInjection); CollidersEnable(btnStatus);; EnableGameObjects(Monstros); if (LastMonster == "Aguia") { EnableGameObjects(Aguia); } else if (LastMonster == "Peixe") { EnableGameObjects(Fish); } else if (LastMonster == "Mamute") { EnableGameObjects(Mamute); } ItemInject.GetComponent <SpriteRenderer> ().sprite = null; ItemSelect = null; MenuInject.SetActive(false); }