Beispiel #1
0
 void AttackLight2()
 {
     if (healthScript.shieldActivated == false)
     {
         soundFX.Attack();
         playerAnimation.Attack_3();
     }
 }
Beispiel #2
0
    void AttackPlayer()
    {
        navAgent.velocity  = Vector3.zero;
        navAgent.isStopped = true;

        enemy_Anim.Walk(false);
        attack_Timer += Time.deltaTime;

        if (attack_Timer > wait_Before_Attack_Time)
        {
            if (UnityEngine.Random.Range(0, 4) > 0)
            {
                enemy_Anim.Attack_1();
                soundFX.Attack();
            }
            else if (UnityEngine.Random.Range(0, 4) > 1)
            {
                enemy_Anim.Attack_2();
                soundFX.Attack();
            }
            else if (UnityEngine.Random.Range(0, 4) > 2)
            {
                enemy_Anim.Attack_3();
                soundFX.Attack();
            }
            else
            {
                enemy_Anim.Attack_4();
                soundFX.Attack();
            }

            attack_Timer = 0f;
        }// if we can attack

        if (Vector3.Distance(transform.position, playerTarget.position) >
            attack_Distance + chase_Player_After_Attack_Distance)
        {
            navAgent.isStopped = false;
            enemy_State        = EnemyState.CHASE;
        }
    }