예제 #1
0
    void Updating()
    {
        if (!soundsStarted)
        {
            soundsStarted = true;
            StartCoroutine("EngardeSound");
        }
        if (!enemy.GetAttackTimer())
        {
            enemy.TimeBeforeAttackStart();
        }
        enemy.Engarde();

        //TRANSITIONS GO HERE
        if (enemy.GetTimerSetOff())
        {
            enemy.SetTimerSetOff(false);
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("attack", true);
            ToAttackState();
        }
        else if (enemy.EnemyIsTooClose())
        {
            GetComponent <Rigidbody>().AddForce(-transform.forward * 5, ForceMode.Impulse);
        }
        else if ((enemy.PlayerInFieldOfView() || enemy.PlayerDetected()) && enemy.EnemyIsOutsideEngardeDistance())
        {
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("chase", true);
            ToChaseState();
        }
        else if (!enemy.PlayerInFieldOfView() && !enemy.PlayerDetected() && !enemy.PlayerIsWithinStrikingDistance())
        {
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("patrol", true);
            ToPatrolState();
        }
        else if (enemy.PlayerIsAttacking() && enemy.WillAttemptToCounter() && enemy.PlayerIsWithinStrikingDistance())
        {
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("block", true);
            ToBlockSwordState();
        }
        else
        {
            ToEngardeState();
        }
    }
예제 #2
0
    void Updating()
    {
        //aim enemy sword/projectile at player and attack

        if (!startedAttack)
        {
            enemy.PlaySound(enemy.enemyAudio, enemy.attackSound);
            startedAttack = true;
            enemy.Attack();
        }

        if (enemy.GetRigidBody().velocity.magnitude >= 0 && enemy.GetRigidBody().velocity.magnitude <= 0.1f)
        {
            endedAttack = true;
        }


        //TRANSITIONS GO HERE
        if ((enemy.PlayerInFieldOfView() || enemy.PlayerDetected()) && !enemy.PlayerIsWithinStrikingDistance() && (endedAttack || (enemy.GetRigidBody().velocity.magnitude >= 0 && enemy.GetRigidBody().velocity.magnitude <= 0.1f)))
        {
            startedAttack = false;
            endedAttack   = false;
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("chase", true);
            ToChaseState();
        }
        else if (enemy.PlayerInFieldOfView() && enemy.PlayerIsWithinStrikingDistance() && (endedAttack || (enemy.GetRigidBody().velocity.magnitude >= 0 && enemy.GetRigidBody().velocity.magnitude <= 0.1f)))
        {
            startedAttack = false;
            endedAttack   = false;
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("engarde", true);
            ToEngardeState();
        }
        else
        {
            startedAttack = false;
            endedAttack   = false;
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("patrol", true);
            ToPatrolState();
        }
    }
    void Updating()
    {
        //dodge shuriken

        //TRANSITIONS GO HERE
        if (enemy.PlayerInFieldOfView() && enemy.PlayerIsWithinStrikingDistance())
        {
            ToAttackState();
        }
        else
        {
            ToChaseState();
        }
    }
예제 #4
0
 void Updating()
 {
     //dodge sword
     enemy.PlaySound(enemy.enemyAudio, enemy.attackSound);
     enemy.AvoidSword();
     //TRANSITIONS GO HERE
     if (!enemy.PlayerInFieldOfView() && !enemy.PlayerIsWithinStrikingDistance() && !enemy.PlayerDetected())
     {
         enemy.ResetAnimatorBools(enemy.anim);
         enemy.anim.SetBool("patrol", true);
         ToPatrolState();
     }
     else
     {
         enemy.ResetAnimatorBools(enemy.anim);
         enemy.anim.SetBool("chase", true);
         ToChaseState();
     }
 }
예제 #5
0
    void Updating()
    {
        /*if (!soundsStarted)
         * {
         *  soundsStarted = true;
         *  enemy.PlaySound(enemy.enemyAudio, enemy.patrolSound);
         *  enemy.enemyAudio.loop = true;
         * }*/
        //randomly move around
        if (enemy.GetPriorityPatrol())
        {
            enemy.PriorityPatrol();
        }
        else
        {
            enemy.Patrol();
        }

        //TRANSITIONS GO HERE
        if ((enemy.PlayerDetected() || enemy.PlayerInFieldOfView()))
        {
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("investigate", true);
            ToInvestigateState();
        }
        else if (enemy.PlayerIsAttacking() && enemy.WillAttemptToCounter() && enemy.PlayerIsWithinStrikingDistance() && enemy.PlayerInFieldOfView())
        {
            enemy.ResetAnimatorBools(enemy.anim);
            enemy.anim.SetBool("block", true);
            ToBlockSwordState();
        }
        else
        {
            ToPatrolState();
        }
    }