float timer; // Timer for counting up to the next attack. private void Awake() { enemyHealth = GetComponent <EnemyHealth>(); anim = GetComponent <Animator>(); myAgent = GetComponent <NavAgentStateMachine_Best>(); //hitbox = GetComponentInChildren<EnemyHitBox>().gameObject; //weaponTrail = GetComponentInChildren<TrailRenderer>().gameObject; if (hitbox != null) { hitbox.SetActive(false); } }
void Awake() { // Setting up the references. anim = GetComponent <Animator>(); enemyAudio = GetComponent <AudioSource>(); myAgent = GetComponent <NavAgentStateMachine_Best>(); enemyAttack = GetComponent <EnemyAttack>(); rb = GetComponent <Rigidbody>(); playerAttack = FindObjectOfType <PlayerAttack>(); // Setting the current health when the enemy first spawns. currentHealth = maxHealth; myUI = Instantiate(enemyHealthUI); }