public void UseProperWaterTexturesForCoastWithLandToTheNorthAndSouthAndWestAndEast() { var waterTextures = new WaterTextures(); // small map for test: // O?O // ?X? // O?O // where O - water, X - island, ? - water where we test textures. var island = new IslandEntity { Corners = new[] { new GeoPoint { X = 1, Y = 1 } } }; var window = new Window(waterTextures, null, new DefaultStrategy(waterTextures.Sea), new CoastWithLandToTheNorthStrategy(waterTextures.CoastWithLandToTheNorth), new CoastWithLandToTheSouthStrategy(waterTextures.CoastWithLandToTheSouth)); window.AddIsland(island); var view = window.GetWindow(0, 0, 3, 3).ToArray(); view[2 * 3 + 1].Texture.Should().Be(waterTextures.CoastWithLandToTheNorth); view[0 * 3 + 1].Texture.Should().Be(waterTextures.CoastWithLandToTheSouth); view[1 * 3 + 0].Texture.Should().Be(waterTextures.CoastWithLandToTheWest); view[1 * 3 + 2].Texture.Should().Be(waterTextures.CoastWithLandToTheEast); }
public void AddIsland(IslandEntity island) { foreach (var item in island.GeneratePoints().ToArray()) { var point = new GeoPoint(item.X, item.Y); points.Add(point, LocationType.Ground); } }
/// <summary> /// Установка новой модели. /// Сеттер не используется из-за нагрузки на инспектор Unity. /// </summary> /// <param name="model"></param> public void SetModel(IslandEntity model) { if (Model != null) { // Отписываемся от событий. } // Подписываемся на события. Model = model; View.Enable(); View.ShowIsland(Model.IslandData); }
public void UseProperTextureForIsland() { var ground = new TextureHolder(); var window = new Window(new WaterTextures(), ground, null, new GroundStrategy(ground)); var island = new IslandEntity { Corners = new[] { new GeoPoint { X = 1, Y = 1 } } }; window.AddIsland(island); var view = window.GetWindow(1, 1, 1, 1); view.First().Texture.Should().Be(ground); }
public void CityTakesPrecedenceOnTerrain() { var ground = new TextureHolder(); var city = new TextureHolder(); var window = new Window(null, city, null, new GroundStrategy(ground), new CityStrategy(city)); var island = new IslandEntity { Corners = new[] { new GeoPoint { X = 1, Y = 1 } } }; window.AddIsland(island); window.AddCity(new CityEntity(1, 1)); var view = window.GetWindow(1, 1, 1, 1).ToArray(); view.First().Texture.Should().Be(city); }
public void LandUnitTakesPrecedenceOnTerrain() { var ground = new TextureHolder(); var city = new TextureHolder(); var landUnit = new TextureHolder(); var window = new Window(null, city, new DefaultStrategy(null), new LandUnitStrategy(landUnit)); var island = new IslandEntity { Corners = new[] { new GeoPoint { X = 1, Y = 1 } } }; window.AddCity(new CityEntity(1, 1)); window.Include(new LandUnitEntity(1, 1)); var view = window.GetWindow(1, 1, 1, 1).ToArray(); view.First().Texture.Should().Be(landUnit); }