} //end onElixerWarrior public void onElixirMage() { if (MageScript.getCurrentMP() + 10 >= MageScript.getMaxMP()) { MageScript.setHP(MageScript.getMaxMP()); } //end if else { MageScript.setMP(MageScript.getCurrentMP() + 10); } //end else BattleTurn.currentTurn++; } //end onElixerMage
// Update is called once per frame void Update() { mageStats.text = "Mage - HP: " + MageScript.getCurrentHP() + "/" + MageScript.getMaxHP() + " MP: " + MageScript.getCurrentMP() + "/" + MageScript.getMaxMP(); }
// Start is called before the first frame update void Start() { GameObject mageStatText = GameObject.Find("MageStatText"); mageStats = mageStatText.GetComponent <Text>(); mageStats.text = "Mage - HP: " + MageScript.getCurrentHP() + "/" + MageScript.getMaxHP() + " MP: " + MageScript.getCurrentMP() + "/" + MageScript.getMaxMP(); }
public void getTurn() { //if % = 0, then its Warrior turn if (currentTurn % 4 == 0) { playerAttackStat = WarriorScript.getAttackStat(); playerDefenseStat = WarriorScript.getDefenseStat(); playerSpeedStat = WarriorScript.getSpeedStat(); playerMagicStat = WarriorScript.getMagicStat(); playerCurrentHP = WarriorScript.getCurrentHP(); playerMaxHP = WarriorScript.getMaxHP(); playerCurrentMP = WarriorScript.getCurrentMP(); playerMaxMP = WarriorScript.getMaxMP(); } //end if //if % = 1, then its Mage turn if (currentTurn % 4 == 1) { playerAttackStat = MageScript.getAttackStat(); playerDefenseStat = MageScript.getDefenseStat(); playerSpeedStat = MageScript.getSpeedStat(); playerMagicStat = MageScript.getMagicStat(); playerCurrentHP = MageScript.getCurrentHP(); playerMaxHP = MageScript.getMaxHP(); playerCurrentMP = MageScript.getCurrentMP(); playerMaxMP = MageScript.getMaxMP(); } //end if //if % = 2, then its Enemy1 turn if (currentTurn % 4 == 2 && EnemyScript.getCurrentHP() > 0) { int randomTarget; randomTarget = Random.Range(1, 100); print(randomTarget); if (randomTarget <= 50) { WarriorScript.setHP(WarriorScript.getCurrentHP() - EnemyScript.getAttackStat() + WarriorScript.getDefenseStat() - 10); } //end if if (randomTarget > 50) { MageScript.setHP(MageScript.getCurrentHP() - EnemyScript.getAttackStat() + MageScript.getDefenseStat() - 10); } //end if currentTurn++; } //end if else if (currentTurn % 4 == 2) { currentTurn++; } //if % = 3, then its Enemy2 turn if (currentTurn % 4 == 3 && Enemy2Script.getCurrentHP() > 0) { int randomTarget; randomTarget = Random.Range(1, 100); print(randomTarget); if (randomTarget <= 50) { WarriorScript.setHP(WarriorScript.getCurrentHP() - Enemy2Script.getAttackStat() + WarriorScript.getDefenseStat() - 10); } //end if if (randomTarget > 50) { MageScript.setHP(MageScript.getCurrentHP() - Enemy2Script.getAttackStat() + MageScript.getDefenseStat() - 10); } //end if currentTurn++; } //end if else if (currentTurn % 4 == 3) { currentTurn++; } }//end getTurn