public static Map CreateFromTemplate(Game game, MapTemplate mapTemplate) { var map = new Map(game, game.Countries); foreach (var countryTemplate in mapTemplate.Countries) { var country = Country.CreateFromTemplate(map, countryTemplate, game.Options.InitialCountryUnits); map.Countries.Add(country); } return map; }
public void WillClone() { // Arrange var mockGame = new Mock<Game>(); var map = new Map(mockGame.Object, mockGame.Object.Countries); var countryA = new Domain.Games.Country("A", 1); map.Countries.Add(countryA); // Act var clone = map.Clone(); countryA.Units = 42; // Assert Assert.AreEqual(1, clone.Countries.Count); var clonedCountryA = clone.Countries.First(); Assert.AreNotEqual(42, clonedCountryA.Units); }
protected ImperaPlus.DTO.Games.History.HistoryTurn MapAndApplyModifiers(HistoryGameTurn turn, Map previousTurnMap) { var mappedTurn = Mapper.Map<DTO.Games.History.HistoryTurn>(turn); var mappedMap = Mapper.Map<DTO.Games.Map.Map>(previousTurnMap); // Apply visibility modifications foreach (var visibilityModifier in turn.Game.Options.VisibilityModifier) { var visibilityModifierInstance = this.visibilityModifierFactory.Construct(visibilityModifier); visibilityModifierInstance.Apply(this.CurrentUser, mappedTurn, mappedMap); } return mappedTurn; }
public static Country CreateFromTemplate(Map map, CountryTemplate countryTemplate, int units) { return new Country(countryTemplate.Identifier, units); }