private void OnStateEnter(CharacterControlState state)
        {
            // Clear our target when transitioning between states
            targetInteraction = null;

            // Only enable HUD animations if the character is human-controlled
            enableInteractionUI = state is HumanCharacterControlState;
        }
示例#2
0
 private void Start()
 {
     // Init control state
     if (defaultControlState == null)
     {
         defaultControlState = GetComponent <CharacterControlState>();
     }
     SetControlState(defaultControlState);
 }
示例#3
0
        protected void SetControlState(CharacterControlState state)
        {
            if (CurrentControlState)
            {
                CurrentControlState.OnStateExit();
                OnControlStateExit?.Invoke(CurrentControlState);
            }

            CurrentControlState = state;

            if (CurrentControlState)
            {
                CurrentControlState.OnStateEnter();
                OnControlStateEnter?.Invoke(CurrentControlState);
            }
        }