Пример #1
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        _playerStateMachine = animator.GetComponent <ICharacterStateMachine>();
        _mover = animator.GetComponent <IDirectionMoverComponent>();

        _minDistance = _playerStateMachine.DistanceThreshold + _playerStateMachine.ArrivingDistance;
    }
Пример #2
0
 private void Awake()
 {
     _mover                = GetComponent <IDirectionMoverComponent>();
     _fieldOfView          = GetComponent <IFieldOfView>();
     CharacterStateMachine = GetComponent <ICharacterStateMachine>();
     _currentState         = wanderState;
 }
Пример #3
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        _playerStateMachine = animator.GetComponent <ICharacterStateMachine>();
        _mover = animator.GetComponent <IDirectionMoverComponent>();

        if (_playerStateMachine.TargetObject != null)
        {
            if (_playerStateMachine.TargetObject.tag != "Enemy" && _playerStateMachine.TargetObject.tag != "Player")
            {
                return;
            }
            Vector3 direction = _playerStateMachine.TargetObject.transform.position - _mover.CurrentPosition;

            _mover.MoveDirection(direction);
            _mover.MoveDirection(Vector3.zero);
        }
    }
Пример #4
0
 //OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     _playerStateMachine = animator.GetComponent <ICharacterStateMachine>();
     _mover = animator.GetComponent <IDirectionMoverComponent>();
 }