IEnumerator GroundPound() { if (timers.transform.GetChild(3).gameObject.GetComponent <TimerController>().CanAttack()) { // Start Attacking timers.transform.GetChild(3).gameObject.GetComponent <TimerController>().Reset(); isAttacking = true; // Animate Jump soundManager.PlaySound(soundManager.jump); shield.SetActive(false); weapon.SetActive(true); playerAnimator.SetTrigger("Jump"); yield return(new WaitForSeconds(0.5f)); shadow.SetActive(true); // Animate Ground Pound soundManager.PlaySound(soundManager.groundPound); Instantiate(particles, transform); // Damage Enemies Collider2D[] results = new Collider2D[8]; groundPoundCollider.OverlapCollider(contactFilter, results); foreach (Collider2D col in results) { if (col != null) { EnemyController enemy = col.gameObject.GetComponent <EnemyController>(); if (enemy != null) { StartCoroutine(enemy.TakeDamage(attack * 3)); if (IsOgreStrength()) { StartCoroutine(enemy.PoisonDamage()); } } KingController king = col.gameObject.GetComponent <KingController>(); if (king != null) { StartCoroutine(king.TakeDamage(attack * 3)); if (IsOgreStrength()) { StartCoroutine(king.PoisonDamage()); } } } } // Stop Attacking questManager.Event("Ground Pound", "Use", true); yield return(new WaitForSeconds(1)); shadow.SetActive(false); StopBounce(); isAttacking = false; } }
IEnumerator SpinAttack() { if (timers.transform.GetChild(2).gameObject.GetComponent <TimerController>().CanAttack()) { // Start Attacking timers.transform.GetChild(2).gameObject.GetComponent <TimerController>().Reset(); isAttacking = true; // Animate Spin Attack soundManager.PlaySound(soundManager.spinAttack); shield.SetActive(false); weapon.SetActive(true); weaponAnimator.SetTrigger("Spin"); // Damage Enemies Collider2D[] results = new Collider2D[5]; spinAttackCollider.OverlapCollider(contactFilter, results); foreach (Collider2D col in results) { if (col != null) { EnemyController enemy = col.gameObject.GetComponent <EnemyController>(); if (enemy != null) { StartCoroutine(TakeKnockback(enemy.transform.position)); StartCoroutine(enemy.TakeDamage(attack * 2)); if (IsOgreStrength()) { StartCoroutine(enemy.PoisonDamage()); } } KingController king = col.gameObject.GetComponent <KingController>(); if (king != null) { StartCoroutine(TakeKnockback(king.transform.position)); StartCoroutine(king.TakeDamage(attack * 2)); if (IsOgreStrength()) { StartCoroutine(king.PoisonDamage()); } } } } yield return(new WaitForSeconds(0.5f)); // Stop Attacking questManager.Event("Spin Attack", "Use", true); StopBounce(); isAttacking = false; } }