void Update() { #if UNITY_EDITOR if (isDummy) { return; } if (actorController == null) { return; // prevents error spam after editing a script } #endif actorController.UpdateCommands(); ActionStateType nextAction = actionState.UpdateState(); if (nextAction != ActionStateType.NONE) { if (!actionStateLookup.TryGetValue(nextAction, out IActionState newAction)) { Debug.Log(this.name + " could not find actionState for " + nextAction.ToString()); } else { ActionStateType prevAction = actionState.ExitState(nextAction); actionState = newAction; actionState.EnterState(prevAction); currentActionState = nextAction; } } }
/// <summary> /// A hack to get button input in the elevator. /// </summary> public void EnterElevator() { ActionStateType nextAction = ActionStateType.ELEVATOR; if (!actionStateLookup.TryGetValue(nextAction, out IActionState newAction)) { Debug.Log(this.name + " could not find actionState for " + nextAction.ToString()); } else { ActionStateType prevAction = actionState.ExitState(nextAction); actionState = newAction; actionState.EnterState(prevAction); currentActionState = nextAction; } }