コード例 #1
0
 /// <inheritdoc />
 /// <summary>
 /// Adds a new control state, assumed to apply to all valid view states.
 /// </summary>
 /// <param name="controlState">
 /// Control state definition object.
 /// </param>
 public void AddControlState(IControlState controlState)
 {
     foreach (string viewState in _validStates)
     {
         AddControlState(viewState, controlState);
     }
 }
コード例 #2
0
 public Player( Game game, IControlState p_controls )
     : base(game)
 {
     Lives = 3;
     Score = 0;
     m_Controls = p_controls;
     m_NextLiveAt = c_PointsPerLife;
     m_Position = new Vector2( Game.GraphicsDevice.Viewport.Width / 2, Game.GraphicsDevice.Viewport.Height - Sprite.Height );
 }
コード例 #3
0
        /// <inheritdoc />
        /// <summary>
        /// Adds a new control state, assumed to apply only to the given view state.
        /// </summary>
        /// <param name="state">
        /// View state
        /// </param>
        /// <param name="controlState">
        /// Control state definition object.
        /// </param>
        public void AddControlState(string state, IControlState controlState)
        {
            // Add name, if not seen before
            if (!_controlIDs.Contains(controlState.ID))
            {
                _controlIDs.Add(controlState.ID);
            }

            _controlStateMap[state][controlState.ID] = controlState;
        }
コード例 #4
0
        public Player( IControlState p_controls, GraphicsDevice p_Device, ContentManager p_Manager )
        {
            if( s_Sprite == null ) {
                s_Sprite = p_Manager.Load<Texture2D>( "Ship" );
            }

            Lives = 3;
            Score = 0;
            m_Device = p_Device;
            m_Manager = p_Manager;
            m_Controls = p_controls;
            m_NextLiveAt = c_PointsPerLife;
            m_StartingPosition = new Vector2( ( p_Device.Viewport.Width / 2 ) - ( Sprite.Width / 2 ), p_Device.Viewport.Height - ( Sprite.Height / 2 ) );
            m_Position = new Vector2( p_Device.Viewport.Width / 2, p_Device.Viewport.Height - Sprite.Height );
        }
コード例 #5
0
 public static void Restore(this Control control, IControlState state)
 {
     state.Restore(control);
 }
コード例 #6
0
		/// <summary>
		/// Allows the game to perform any initialization it needs to before starting to run.
		/// This is where it can query for any required services and load any non-graphic
		/// related content.  Calling base.Initialize will enumerate through any components
		/// and initialize them as well.
		/// </summary>
		protected override void Initialize() {
			GamePadState = new ControllerOneControlState( this );
			Components.Add( GamePadState );
#if Threading
			Thread _StarThread = new Thread( CreateStars );
			_StarThread.Start();
#endif
			base.Initialize();
		}