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; }
private void Start() { // Init control state if (defaultControlState == null) { defaultControlState = GetComponent <CharacterControlState>(); } SetControlState(defaultControlState); }
protected void SetControlState(CharacterControlState state) { if (CurrentControlState) { CurrentControlState.OnStateExit(); OnControlStateExit?.Invoke(CurrentControlState); } CurrentControlState = state; if (CurrentControlState) { CurrentControlState.OnStateEnter(); OnControlStateEnter?.Invoke(CurrentControlState); } }