void EnemyHitPlayer(SwordGameEnemy enemy) { // remove enemy from both slash areas leftSlashArea.RemoveEnemy(enemy); rightSlashArea.RemoveEnemy(enemy); swordGame.Score += onPlayerHitScore; enemy.OnHitPlayer(); }
void OnTriggerEnter(Collider collider) { SwordGameEnemy enemy = collider.GetComponent <SwordGameEnemy>(); if (enemy) { EnemyHitPlayer(enemy); } }
void OnTriggerExit(Collider collider) { SwordGameEnemy enemy = collider.GetComponent <SwordGameEnemy>(); if (enemy) { enemies.Remove(enemy); } }
void OnTriggerEnter(Collider collider) { SwordGameEnemy enemy = collider.GetComponent <SwordGameEnemy>(); if (enemy) { enemies.Add(enemy); } }
public void RemoveEnemy(SwordGameEnemy enemy) { if (enemies.Contains(enemy)) { if (enemy.IsDead()) { enemies.Remove(enemy); } } }
void KillEnemy(SwordGameEnemy enemy) { toBeRemoved.Add(enemy); swordGame.Score += enemy.pointsValue; enemy.Kill(); }