void Update()
 {
     currentState.UpdateState(this);
     currentspeed = agent.speed;
     Debug.Log("Current State : " + currentState);
     //AnimationState();
     VisionCone(enemyFOV, 10);
 }
Esempio n. 2
0
    public void UpdateStateMachine()
    {
        //Debug.Log(_currentState);
        if (_currentState == null)
        {
            _currentState = _possibleStates.First();
        }

        var nextState = _currentState?.UpdateState();

        if (nextState != null &&
            nextState != _currentState.GetType())
        {
            ChangeState(nextState);
        }
    }
 void Update()
 {
     distanceToPlayer = Vector3.Distance(transform.position, playerTransform.position);
     currentState.UpdateState(this);
 }