/// <summary> /// Starts the changing of the position. /// </summary> public void StartChangingPosition( ) { StateComponent stateHandler = Player.GetComponent <StateComponent>( ); pausedWhenChangingPosition = stateHandler.CurrentState == StateComponent.PlayerState.Paused; stateHandler.Pause( ); stateHandler.CurrentState = StateComponent.PlayerState.ChangingPosition; }
/// <summary> /// Stops the changing of the position. /// </summary> public void StopChangingPosition( ) { StateComponent stateHandler = Player.GetComponent <StateComponent>( ); if (stateHandler.CurrentState != StateComponent.PlayerState.ChangingPosition) { throw new Exception("Can't stop changing the position if not currently changing the position."); } if (!pausedWhenChangingPosition) { stateHandler.Play( ); } else { stateHandler.CurrentState = StateComponent.PlayerState.Paused; } }
/// <summary> /// Constructor. /// </summary> /// <param name="state">The new <see cref="StateComponent.PlayerState"/>.</param> public OnStateChangedEventArgs( StateComponent.PlayerState state ) { State = state; }