// Start is called before the first frame update void Start() { _player = GameObject.FindWithTag("Player").transform; _navMeshAgent = GetComponent <NavMeshAgent>(); _ability = gameObject.GetComponentInChildren <EnemyAbility>(); isPaused = false; _killCounter = GameObject.FindWithTag("KillCounter").GetComponent <KillCounter>(); _loot = GetComponent <DropLoot>(); _animator = GetComponent <Animator>(); _audioManager = GameObject.FindWithTag("AudioManager").GetComponent <AudioManagerScript>(); }
public void Die() { // destroy object currentHealth = 0; DropLoot lootDropping = GetComponent <DropLoot>(); if (lootDropping != null) { lootDropping.Drop(); } Destroy(gameObject); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); } DontDestroyOnLoad(gameObject); }
// Use this for initialization void Start () { dropLoot = GetComponent<DropLoot>(); }