private void OnTriggerEnter2D(Collider2D other) { if (!inReplay) { if (other.gameObject.CompareTag("Player") && (!playerStateManager.IsPowerUp() || !flee)) { Debug.Log("GG"); playerStateManager.Dead(); foreach (GameObject friend in allGhost) { if (friend.GetInstanceID() == this.GetInstanceID()) { continue; } friend.GetComponent <EnemyScript>().FriendEaten(); } } if (other.gameObject.CompareTag("Ghost") && aiState != EnemyState.RETURNTOBASE) { aiState = EnemyState.FINDPATH; } } }