/// <summary> /// /// </summary> /// <param name="nextGameplayState"></param> /// <param name="forceReset"></param> public void SetGameplayState(CharacterGameplayState nextGameplayState, bool forceReset = false) { if (nextGameplayState == gameplayState && !forceReset) { return; } gameplayStateHandler?.Exit(); gameplayState = nextGameplayState; gameplayStateHandler?.Enter(); }
/// <summary> /// /// </summary> /// <param name="oldState"></param> private void OnStateChanged(CharacterGameplayState oldState) { if (_task != null) { behaviourManager.StopTask(_task); _task = null; } switch (_characterState) { case CharacterGameplayState.LaunchKey: _task = new AITask_Goto(character.spawner.transform.position); behaviourManager.SetTask(_task, float.MaxValue); break; } switch (oldState) { case CharacterGameplayState.LaunchKey: GetComponent <AIBehaviour_Pickable>().timeBeforeLaunchKey = 0.5f; behaviourManager.StopTask(); break; } }