public void CreateDescFromTowerDescriptionAndCheckPointsPerTile() { var levelFactory = GetLevelFactory(); const int minPoinsPerTile = 10; levelFactory.MinPointsPerTile = minPoinsPerTile; const int poinstPerTileFromTowerDesc = 1; const int expectedPointsPerTile = 11; var towerDesc = new TowerDescription() { PointsPerTile = poinstPerTileFromTowerDesc }; var desc = levelFactory.Create(towerDesc); Assert.AreEqual(expectedPointsPerTile, desc.PointsPerTile); }
public LevelDescription Create(TowerDescription description) { var width = description.Width + MinFieldWidth; var height = description.Height + MinFieldHeight; var turns = description.Turns + MinTurns; var isCoinsDoubled = description.IsCoinsDoubled; var pointsPerTile = MinPointsPerTile + description.PointsPerTile; var targetScore = CalculateTargetScore( width, height, turns, description.WinCoefficent, AverageTileCoefficient); var desc = Create(width, height); desc.IsCoinsDoubled = isCoinsDoubled; desc.PointsPerTile = pointsPerTile; desc.Condition.GameMode = new GameModeDescription { Turns = turns, TargetScore = targetScore }; return desc; }
public void CreateDescFromTowerDescriptionAndCheckSize() { var levelFactory = GetLevelFactory(); const ushort minWidth = 9; const ushort minHeight = 10; levelFactory.MinFieldHeight = minHeight; levelFactory.MinFieldWidth = minWidth; const ushort widthFromTowerDesc = 5; const ushort heightFromTowerDesc = 6; const ushort expectedWidth = 14; const ushort expectedHeight = 16; var towerDescriptionForLevelWidthxHeight = new TowerDescription { Width = widthFromTowerDesc, Height = heightFromTowerDesc }; var desc = levelFactory.Create(towerDescriptionForLevelWidthxHeight); Assert.IsNotNull(desc.Condition); Assert.IsNotNull(desc.Field); Assert.AreEqual(expectedWidth, desc.Field.Width); Assert.AreEqual(expectedHeight, desc.Field.Height); }
public void CreateDoubleCoinsFloorAndCheckThatDescChanged() { var levelFactory = GetLevelFactory(); var towerDesc = new TowerDescription() { IsCoinsDoubled = true }; var desc = levelFactory.Create(towerDesc); Assert.That(desc.IsCoinsDoubled); }
public void CreateDescFromTowerDescriptionAndCheckTurns() { var levelFactory = GetLevelFactory(); const ushort minTurns = 10; const ushort turnsFromTileDescription = 11; const ushort expectedAmount = 21; levelFactory.MinTurns = minTurns; var towerDescription = new TowerDescription() { Turns = turnsFromTileDescription }; var desc = levelFactory.Create(towerDescription); Assert.AreEqual(expectedAmount, desc.Condition.GameMode.Turns); }
public TowerDescription GetTowerDescription() { var towerDesc = new TowerDescription(); foreach (var floor in _floors) { towerDesc.AddFloor(floor.FloorType); } towerDesc.Calculate(); return towerDesc; }