private void CheckGhost() { Ghost ghost = null; if (!pet.upstairFirst) { if (pet.checkDownstair) { ghost = PetUtility.GetDownstairGhost(pet.transform.position); } if (pet.checkUpstair && (ghost == null)) { ghost = PetUtility.GetUpstairGhost(pet.transform.position); //Debug.Log("check downstair"); } } else { if (pet.checkUpstair) { ghost = PetUtility.GetUpstairGhost(pet.transform.position); } if (pet.checkDownstair && (ghost == null)) { ghost = PetUtility.GetDownstairGhost(pet.transform.position); //Debug.Log("check downstair"); } } if (ghost != null) { //Debug.Log("we found ghost: " + ghost.name); pet.enemyInHouse = true; pet.enemy = ghost.gameObject; } else { pet.enemyInHouse = false; pet.enemy = null; } }