// Update is called once per frame void Update() { getTurn(); if (AttackBoost.boostAppliedWarrior == true && AttackBoost.statRevertedWarrior == false && currentTurn == AttackBoost.boostEndWarrior) { WarriorScript.setAttackStat(10); AttackBoost.statRevertedWarrior = true; print("Stat reverted for Warrior"); } //end if if (AttackBoost.boostAppliedMage == true && AttackBoost.statRevertedMage == false && currentTurn == AttackBoost.boostEndMage) { MageScript.setAttackStat(5); AttackBoost.statRevertedMage = true; print("Stat reverted for Mage"); } //end if if (WarriorScript.getCurrentHP() > 100) { WarriorScript.setHP(100); } //end if if (MageScript.getCurrentHP() > 80) { MageScript.setHP(80); } //end if }
// 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(); }
} //end onPotion public void onPotionMage() { if (MageScript.getCurrentHP() + 50 >= 80) { MageScript.setHP(80); } //end if else { MageScript.setHP(MageScript.getCurrentHP() + 50); } //end else BattleTurn.currentTurn++; } //end onPotion
} //end onMoreHealWarrior public void onMoreHealMage() { if (BattleTurn.playerCurrentMP >= 12) { if (BattleTurn.currentTurn % 4 == 0) { MageScript.setHP(MageScript.getCurrentHP() + BattleTurn.playerMagicStat + 20); WarriorScript.setMP(WarriorScript.getCurrentMP() - 12); } //end if if (BattleTurn.currentTurn % 4 == 1) { MageScript.setHP(MageScript.getCurrentHP() + BattleTurn.playerMagicStat + 20); MageScript.setMP(MageScript.getCurrentMP() - 12); } BattleTurn.currentTurn++; } else if (BattleTurn.playerCurrentMP < 12) { errorSound.Play(); } //end else if } //end onMoreHealMage
// Update is called once per frame void Update() { 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