public Tile Parse(XYCoord coord, char input) { Tile tileNorth; Tile tileWest; AllPositions.TryGetValue(new XYCoord(coord.X, coord.Y - 1), out tileNorth); AllPositions.TryGetValue(new XYCoord(coord.X - 1, coord.Y), out tileWest); Tile newTile = null; switch (input) { case 'G': newTile = new Goblin(coord, tileNorth, tileWest); break; case 'E': newTile = new Elf(coord, tileNorth, tileWest); break; case '.': newTile = new Tile(coord, tileNorth, tileWest, TileType.Floor); break; case 'e': newTile = new Elf(coord, tileNorth, tileWest) { IsStaticTestGuy = true }; break; } if (newTile != null) { AllPositions.Add(coord, newTile); } return(newTile); }
public Tile(XYCoord coord, Tile north, Tile west, TileType type) { HP = 0; AP = 0; Type = type; this.coord = coord; Neighbours = new List <Tile>(); if (north != null) { Link(north, true); } if (west != null) { Link(west, true); } }
public Elf(XYCoord coord, Tile north, Tile west) : base(coord, north, west, TileType.Elf) { HP = Solution.ELF_HP; AP = Solution.ELF_AP; }
public Goblin(XYCoord coord, Tile north, Tile west) : base(coord, north, west, TileType.Goblin) { HP = Solution.GOBLIN_HP; AP = Solution.GOBLIN_AP; }