Exemplo n.º 1
0
 public Enemy()
 {
     _chaseState  = new ChaseState(this);
     _idleState   = new IdleState(this);
     _attackState = new AttackState(this);
     _patrolState = new PatrolState(this);
 }
Exemplo n.º 2
0
 public void Discovery()
 {
     if (outViewFied.enabled == true && outViewFied.visibleTargets.Count > 0)
     {
         _nowState = _chaseState;
         _Anim.SetBool("Walk", true);
         player = outViewFied.visibleTargets[0];
         Switch2InView();
         //notDiscovered=false;
     }
 }
Exemplo n.º 3
0
    private void Start()
    {
        _nowState = GetState(beginState);

        _navMashAgent = GetComponent <NavMeshAgent>();

        _Anim = GetComponent <Animator>();
        Switch2OutView();

        if (inViewFied.viewRadius > outViewFied.viewRadius)
        {
            FieldOfView temp = inViewFied;
            inViewFied  = outViewFied;
            outViewFied = temp;
        }
    }
Exemplo n.º 4
0
 public void InToAttack()
 {
     if (inViewFied.enabled == true)
     {
         if (inViewFied.visibleTargets.Count > 0)
         {
             _nowState = _attackState;
             _Anim.SetBool("Attack", true);
             player         = inViewFied.visibleTargets[0];
             playerCanbeHit = true;
         }
         else
         {
             _nowState = _chaseState;
             _Anim.SetBool("Attack", false);
             playerCanbeHit = false;
         }
     }
 }
Exemplo n.º 5
0
 void Start()
 {
     currentState = enemyIdle;
 }