IEnumerator Waitable() { if (stage == 0) { isPlayerTurn = false; if (PlayerController.playerAttack > 0) { ChemistryController.GiveTask(0); } else { stage = 1; } } if (stage == 1) { if (PlayerController.playerAttack > 0) { swiper.EnableRightSwipe(); yield return(new WaitForSeconds(1)); swiper.DisableRightSwipe(); } if (PlayerController.playerDefence > 0) { ChemistryController.GiveTask(1); } else { stage = 2; } } if (stage == 2) { if (PlayerController.playerDefence > 0) { swiper.EnableLeftShield(); yield return(new WaitForSeconds(1.5f)); } EnemyController.TakeDamage(); yield return(new WaitForSeconds(0.5f)); EnemyController.ShiftEnemies(); yield return(new WaitForSeconds(1.0f)); if (EnemyController.enemyCount == 0) { Debug.Log("YOU WIN!"); bigLabelStatus = "YOU WIN!"; hasWon = true; menuPanel.gameObject.SetActive(true); retryButton.gameObject.SetActive(true); } else { EnemyController.enemyAP += turnCount; yield return(new WaitForSeconds(0.5f)); EnemyController.UseAP(); if (enemyHasDefended > 0) { swiper.EnableRightShield(); yield return(new WaitForSeconds(1.5f)); } yield return(new WaitForSeconds(0.5f)); EnemyController.DealDamage(); if (enemyHasAttacked > 0) { swiper.EnableLeftSwipe(); yield return(new WaitForSeconds(1)); swiper.DisableLeftSwipe(); } if (PlayerController.playerHealth <= 0) { Debug.Log("YOU LOSE."); bigLabelStatus = "YOU LOSE."; hasLost = true; menuPanel.gameObject.SetActive(false); retryButton.gameObject.SetActive(true); } else { turnCount++; PlayerController.playerAP += turnCount; PlayerController.playerDefence = 0; PlayerController.playerAttack = 0; DebugPrint(); isPlayerTurn = true; stage = 0; } } } yield return(new WaitForSeconds(0)); }