//Enemy Attack Manual IEnumerator PerformEnemyMove() { state = BattleState.Busy; yield return(dialogBox.TypeDialog("Incorrect!!")); bool isFainted = playerUnit.Characters.TakeDamage(enemyUnit.Characters); yield return(playerHud.UpdateHP()); if (isFainted) { FindObjectOfType <GameManager>().EndGame(); yield return(dialogBox.TypeDialog($"Game Over")); yield return(new WaitForSeconds(2f)); OnBattleOver(false); } else { dialogBox.EnableTextDialog(false); PlayerMove(); } }
IEnumerator RunEnemyTurn() { dialogueText.text = "The enemy is attacking."; yield return(new WaitForSeconds(1f)); playerUnit.TakeDamage(enemyUnit.attack); playerBattleHUD.UpdateHP(playerUnit.currentHP); dialogueText.text = "The attack is successful."; yield return(new WaitForSeconds(2f)); EndOneTurn(); }
// //Player Attack // IEnumerator PerformPlayerMove() { state = BattleState.Busy; //set ka ng value ni state int rand_number_compliment = UnityEngine.Random.Range(1, 4); if (rand_number_compliment == 1) { yield return(dialogBox.TypeDialog("Correct!!")); //show dialog box } if (rand_number_compliment == 2) { yield return(dialogBox.TypeDialog("Awesome!!")); //show dialog box } if (rand_number_compliment == 3) { yield return(dialogBox.TypeDialog("Nice")); //show dialog box } // yield return new WaitForSeconds(1f); // wait 1 sec bool isFainted = enemyUnit.Characters.TakeDamage(playerUnit.Characters); //babawasan nia ung HP yield return(enemyHud.UpdateHP()); //animation ng hp if (isFainted) { yield return(dialogBox.TypeDialog($"enemy {enemyUnit.Characters.Base.Name} defeated")); yield return(new WaitForSeconds(1f)); OnBattleOver(true); } else { dialogBox.EnableTextDialog(false); PlayerMove(); } }