void Update() { target = GameObject.Find("Player").transform.position; if (room.playerInRoom == true) { if (gameObject.name == "Zombie(Clone)" || gameObject.name == "Skull Enemy(Clone)") { Seek(transform.position, target); } else if (gameObject.name == "Skeleton(Clone)") { GetComponent <NavMeshAgent>().destination = target; } } else { Wander(); } if (this.currentHealth <= 0 && stopUpdate == false) { dropPickup.DropItem(); Die(this.gameObject); stopUpdate = true; room.enemyCount--; } }
public void DestroyObject(GameObject objectToBeDestroyed) { dropPickup = GetComponent <DropPickup>(); dropPickup.DropItem(); Destroy(objectToBeDestroyed); }