public Game(IRenderer renderer, IRenderItemFactory factory, IInput input, int targetFramerate) { this.targetFramerate = targetFramerate; this.renderer = renderer; this.input = input; this.factory = factory; Start(); }
public SnakeHead(Game game, IRenderItemFactory factory) : base(game, factory, new Vector2I(0, 0)) { Direction = Game.Rules.SnakeStartDirection; direction = Direction; Position = Game.Rules.SnakeStartPosition; RenderItem = factory.CreateRenderItem(RenderItemType.SnakeHead); }
public World(Game game, IRenderItemFactory factory, GameRules rules) { this.game = game; this.factory = factory; Head = new SnakeHead(game, factory); CreateWorld(game, factory, rules, rules.WorldSize); Random random = new Random(); Treat = new Treat(game, factory, new Vector2I(random.Next(1, rules.WorldSize.X - 1), random.Next(1, rules.WorldSize.Y - 1))); }
public Field(Game game, IRenderItemFactory factory, Vector2I position) { Position = position; Game = game; Factory = factory; }
public Treat(Game game, IRenderItemFactory factory, Vector2I position) : base(game, factory, position) { RenderItem = factory.CreateRenderItem(RenderItemType.Treat); }
public SnakeBody(Game game, IRenderItemFactory factory, Vector2I position) : base(game, factory, position) { RenderItem = factory.CreateRenderItem(RenderItemType.SnakeBody); }
public SpeedPowerup(Game game, IRenderItemFactory factory, Vector2I position) : base(game, factory, position) { RenderItem = factory.CreateRenderItem(RenderItemType.SpeedPowerup); }
public Game(IRenderer renderer, IRenderItemFactory factory, IInput input) : this(renderer, factory, input, 60) { }
private void CreateWorld(Game game, IRenderItemFactory factory, GameRules rules, Vector2I size) { for (int x = 0; x < size.X; x++) for (int y = 0; y < size.Y; y++) if ((x == 0 || x == size.X - 1) || (y == 0 || y == size.Y - 1)) blocks.Add(new Block(game, factory, new Vector2I(x, y))); }