/* * @param other, the other GameObject * @param takeDamage, the amount of damage that the other GameObject receives * On collision, the other GameObject takes damage */ protected override void OnCollideTakeDamage(Collider2D other, ITakeDamage takeDamage) { // Handles what happens when the enemy is frozen if (other.GetComponent <EnemyAI>() != null && CanFreeze == true) { Enemy.Status = EnemyAI.EnemyStatus.Frozen; Enemy.MovementSpeed = 0f; Enemy.SpriteColor.color = Color.cyan; Enemy.StartCoroutine(Enemy.CountdownDebuff()); } // Handles what happens when the enemy is confused if (other.GetComponent <EnemyAI>() != null && CanConfuse == true) { Enemy.Status = EnemyAI.EnemyStatus.Confused; Enemy.StartCoroutine(Enemy.CountdownDebuff()); Enemy.Reverse(); Enemy.SpriteColor.color = Color.red; } // Handles what happens when the enemy is disabled if (other.GetComponent <EnemyAI>() != null && CanPoison == true) { Enemy.Status = EnemyAI.EnemyStatus.Poisoned; Enemy.StartCoroutine(Enemy.CountdownDebuff()); Enemy.SpriteColor.color = Color.green; } // Handles what happens when the enemy is paralyzed if (other.GetComponent <EnemyAI>() != null && CanParalyze == true) { Enemy.Status = EnemyAI.EnemyStatus.Paraylyzed; Enemy.StartCoroutine(Enemy.CountdownDebuff()); Enemy.CanFireProjectiles = false; Enemy.SpriteColor.color = Color.yellow; } takeDamage.TakeDamage(Damage, gameObject); DestroyProjectile(); // destroys the projectile }