Пример #1
0
        /// <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;
        }
Пример #2
0
        /// <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;
            }
        }
Пример #3
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="state">The new <see cref="StateComponent.PlayerState"/>.</param>
 public OnStateChangedEventArgs( StateComponent.PlayerState state )
 {
     State = state;
 }