private void LoadSprites(BackColorEnum backColor) { foreach (SpriteTypeEnum itemType in GetValues <SpriteTypeEnum>()) { string texturePath = string.Format("Graphics/{0}/{1}", backColor, itemType); var texture = _content.Load <Texture2D>(texturePath); var item = new GameSprite(itemType, texture, backColor); _collection.Add(item); } }
public GameSprite this[SpriteTypeEnum itemType, BackColorEnum backColor] { get { return(_collection.FirstOrDefault(c => c.ItemType == itemType && c.BackColor == backColor)); } }
public GameSprite(SpriteTypeEnum itemType, Texture2D texture, BackColorEnum backColor) { ItemType = itemType; Texture = texture; BackColor = backColor; }
private void UpdateSplash(KeyboardState kState, GamePadState gState, GameTime gameTime) { if (kState.IsKeyPressed(_oldKeyState, Keys.Enter, Keys.Space, Keys.Escape, Keys.D0, Keys.D1, Keys.D2, Keys.D3, Keys.D4, Keys.D5, Keys.D6, Keys.D7) || gState.IsButtonPressed(_oldGamePadState, Buttons.Start)) { _displayMode = DisplayModeEnum.GameStart; _splashInterval = new TimeSpan(Game.GameSpeedScaleFactor*40); } _splashInterval = _splashInterval - gameTime.ElapsedGameTime; if (_splashInterval.Ticks < 0) { _backColor = (_backColor == BackColorEnum.White ? BackColorEnum.Black : BackColorEnum.White); _splashInterval = new TimeSpan(Game.GameSpeedScaleFactor*20); } }