public static void Add(Tile t) { Tiles.Insert(t.Id, t); }
private void Init() { Tile t = new Tile(Resources.Grass, 0); TileRepository.Add(t); t = new Tile(Resources.Rock, 1); t.IsSolid = true; TileRepository.Add(t); Tile brick = new Tile(Properties.Resources.BrickWall, 2); brick.IsSolid = true; TileRepository.Add(brick); Tile grassstone = new Tile(Properties.Resources.FloorsMedieval, 3); grassstone.IsSolid = false; TileRepository.Add(grassstone); Player = CreatePlayer(); gameWorld.Player = Player; gameWorld.GameObjects.Add(Player); Random r = new Random(); for (int i = 0; i < 5; i++) { DecimalPoint loc; int x; int y; do { x = r.Next(2000); y = r.Next(2000); loc = new DecimalPoint(x, y); } while (gameWorld.GetTile(x / Tile.Width, y / Tile.Height).IsSolid); Enemy monster = new Monster(gameWorld, loc); gameWorld.GameObjects.Add(monster); } if(Loaded != null) Loaded(this, EventArgs.Empty); }