Exemplo n.º 1
0
    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);
        }
    }
Exemplo n.º 2
0
    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);
    }