示例#1
0
 void AttackLight()
 {
     if (healthScript.shieldActivated == false)
     {
         soundFX.Attack();
         playerAnimation.Attack_1();
         a = true;
     }
 }
 void GetInput()
 {
     if (controller.isGrounded)
     {
         if (Input.GetMouseButtonDown(0))
         {
             soundFX.Attack();
             Attack();
         }
     }
 }
示例#3
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;
        }
    }
    void AttackPlayer()
    {
        navAgent.velocity  = Vector3.zero;
        navAgent.isStopped = true;


        attackTimer += Time.deltaTime;

        if (attackTimer > waitBeforeAttackTime)
        {
            enemy_Anim.SetInteger(parameterAnim.condition, 2);
            attackTimer = 0f;
            soundFX.Attack();
        }

        if (Vector3.Distance(transform.position, playerTarget.transform.position) > attackDistance + chasePlayerAfterAttackDistance)
        {
            navAgent.isStopped = false;
            enemyState         = EnemyState.CHASE;
        }
    }