public MainGameState() { Model = new GameModel(); Buttons = new List<Button>(); _renderManager = new MainGameRenderManager(); _inputManager = new MainGameInputManager(); }
public override void Execute(GameModel gameState) { var cardToDraw = gameState.MainDeck.FirstOrDefault(); if (cardToDraw != null) { if (cardToDraw.Type == CardTypeEnum.Location) { gameState.Hand.Add(cardToDraw); gameState.MainDeck.Remove(cardToDraw); if(gameState.Hand.Count == 5) { NextCommand = new Shuffle(); } else { NextCommand = new Draw(); } } else if (cardToDraw.Type == CardTypeEnum.Door) { NextCommand = new HandleDoor(cardToDraw); } else if (cardToDraw.Type == CardTypeEnum.Nightmare) { NextCommand = new HandleNightmare(cardToDraw); } } else { NextCommand = new Lose(); } }
public override void Execute(GameModel gameState) { // draw card var card = gameState.MainDeck.First(); // if location, add to hand if (card.Type == CardTypeEnum.Location) { gameState.MainDeck.Remove(card); gameState.Hand.Add(card); } // else, add to limbo else { gameState.MainDeck.Remove(card); gameState.Limbo.Add(card); } // if hand == 5 next command shuffle if(gameState.Hand.Count() == 5) { NextCommand = new Shuffle(); } // else next command drawlocations else { NextCommand = new DrawLocations(); } }
public override void Execute(GameModel gameState) { gameState.ProphecyArea.Clear(); gameState.MainDeck.Remove(Location); gameState.DiscardPile.Add(Location); NextCommand = new Draw(); }
private void DrawDiscardPile(SpriteBatch spriteBatch, GameModel state, int screenWidth, int screenHeight) { if (state.DiscardPile.Any()) { var front = state.DiscardPile.Last().Front; spriteBatch.Draw(front, new Rectangle(50, 50, 100, 175), Color.White); } }
public override void Execute(GameModel gameState) { gameState.Hand.Remove(Location); gameState.DiscardPile.Add(Location); gameState.Doors.Add(gameState.DrawnDoor); gameState.DrawnDoor = null; NextCommand = new Draw(); }
private void DrawDeck(SpriteBatch spriteBatch, GameModel state, int screenWidth, int screenHeight) { if(state.MainDeck.Any()) { var back = state.MainDeck.First().Back; spriteBatch.Draw(back, new Rectangle(175, 50, 100, 175), Color.White); } }
public override void Execute(GameModel gameState) { gameState.MainDeck.Remove(_door); if(gameState.Hand.Any(x => x.Symbol == CardSymbolEnum.Key && x.Color == _door.Color)) { gameState.DrawnDoor = _door; } else { gameState.Limbo.Add(_door); NextCommand = new Draw(); } }
private void DrawDoors(SpriteBatch spriteBatch, GameModel state, int screenWidth, int screenHeight) { var doors = state.Doors.ToArray(); var xPos = 300; var yPos = 50; for (int i = 0; i < doors.Count(); i++) { var front = doors[i].Front; var yPosFactor = (int)Math.Floor(i / 23d) * 175 + yPos; spriteBatch.Draw(front, new Rectangle(xPos + 75 * (i % 23), yPosFactor, 100, 175), Color.White); } }
public override void Execute(GameModel gameState) { gameState.Hand.Remove(Location); gameState.DiscardPile.Add(Location); if(Location.Symbol == CardSymbolEnum.Key) { NextCommand = new Prophecy(); } else { NextCommand = new Draw(); } }
public override void Execute(GameModel gameState) { gameState.PlayArea.Add(Location); gameState.Hand.Remove(Location); if(gameState.PlayArea.Count() >= 3) { var reversePlayArea = gameState.PlayArea.Reverse<Card>(); var lastThreeGrouped = reversePlayArea.Take(3).GroupBy(x => x.Color); if(lastThreeGrouped.Count() == 1) { NextCommand = new GainDoor(lastThreeGrouped.First().Key); } else { NextCommand = new Draw(); } } else { NextCommand = new Draw(); } }
public void Draw(SpriteBatch spriteBatch, int screenWidth, int screenHeight, GameModel model, List<Button> buttons) { spriteBatch.Begin(); DrawLimbo(spriteBatch, model, screenWidth, screenHeight); DrawDeck(spriteBatch, model, screenWidth, screenHeight); DrawPlayArea(spriteBatch, model, screenWidth, screenHeight); if(model.DrawnDoor != null) { DrawDrawnDoorAndKey(spriteBatch, model, screenWidth, screenHeight, buttons); } else if(model.ProphecyArea.Any()) { DrawProphecyArea(spriteBatch, model, screenWidth, screenHeight, buttons); } else { DrawHand(spriteBatch, model, screenWidth, screenHeight, buttons); } DrawDiscardPile(spriteBatch, model, screenWidth, screenHeight); DrawDoors(spriteBatch, model, screenWidth, screenHeight); spriteBatch.End(); }
private void DrawDrawnDoorAndKey(SpriteBatch spriteBatch, GameModel state, int screenWidth, int screenHeight, List<Button> buttons) { var door = state.DrawnDoor; var key = state.Hand.First(x => x.Symbol == CardSymbolEnum.Key && x.Color == door.Color); var xPos = 175; var yPos = (screenHeight - 750); spriteBatch.Draw(door.Front, new Rectangle(175, yPos, 100, 175), Color.White); spriteBatch.Draw(key.Front, new Rectangle(175, yPos + 300, 100, 175), Color.White); for(var i = 0; i < buttons.Count; i++) { buttons[i].Draw(spriteBatch, new Rectangle(175 + i * 55, yPos + 500, 50, 175 / 2)); } }
public override void Execute(GameModel gameState) { }
public override void Execute(GameModel gameState) { NextCommand = new Reset(); }
public abstract void Execute(GameModel gameState);
public override void Execute(GameModel gameState) { gameState.MainDeck.AddRange(gameState.Limbo); gameState.Limbo.Clear(); DeckUtilities.ShuffleCards(gameState.MainDeck); }
public override void Execute(GameModel gameState) { gameState.Limbo.Add(gameState.DrawnDoor); gameState.DrawnDoor = null; NextCommand = new Draw(); }
private void DrawProphecyArea(SpriteBatch spriteBatch, GameModel state, int screenWidth, int screenHeight, List<Button> buttons) { var prophecy = state.ProphecyArea.ToArray(); var xPos = (screenWidth - 700) / 2; var yPos = (screenHeight - 400); for (int i = 0; i < prophecy.Count(); i++) { var front = prophecy[i].Front; spriteBatch.Draw(front, new Rectangle(xPos + 150 * i, yPos, 100, 175), Color.White); var buttonForLocation = buttons.Where(x => ((ILocationable)x.Command).Location.Id == prophecy[i].Id); DrawButtons(spriteBatch, buttonForLocation, xPos + 150 * i, yPos + 200); } }
public override void Execute(GameModel gameState) { var topFiveOfDeck = gameState.MainDeck.Take(5); gameState.ProphecyArea.AddRange(topFiveOfDeck); }
public override void Execute(GameModel gameState) { gameState.MainDeck.Remove(_nightmare); gameState.DiscardPile.Add(_nightmare); NextCommand = new Draw(); }