Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Test]
- public void MoveTo2_0_from_0_0()
- {
- var cells = player1.GameState.Cells;
- var sectors = player1.GameState.Sectors;
- var squadView = player1.ViewState.SquadViews.GetEntities()[0];
- var squadEntity = squadView.squadViewsModelEntity.Value;
- var pathfinding = player1.ViewState.ViewSingletones.cellPathfinder.value;
- var paths = squadView.movementMatrix.Paths;
- MovementUtility.SyncCellsWithPathfinding(cells, pathfinding);
- MovementUtility.FillMovementMatrixForSquad(sectors, cells, squadEntity, squadView, pathfinding, player1.GameState.Singletones.coverMatrix.MovementCost);
- //0 0 0 0 0
- //0 0 0 0 0
- //0 0 0 0 0
- //0 0 0 0 0
- //x -> t 0 0
- //path to 0,0
- CollectionAssert.AreEqual(new[] { 0, -1 }, paths[0].Take(2));
- //path to 2,0
- CollectionAssert.AreEqual(new[] { 0 , 1, 2 , -1 }, paths[2].Take(4));
- //0 0 0 0 0
- //0 0 0 0 0
- //0 0 0 0 0
- //0 0 0 0 0
- //t <- x 0 0
- //move squad to 2,0,0
- var targetCellId = FieldUtility.GetId(2, 0, 0);
- squadEntity.ReplaceCellReference(targetCellId);
- cells.ById(0).RemoveSquadReference();
- cells.ById(targetCellId).ReplaceSquadReference(0);
- MovementUtility.SyncCellsWithPathfinding(cells, pathfinding);
- MovementUtility.FillMovementMatrixForSquad(sectors, cells, squadEntity, squadView, pathfinding, player1.GameState.Singletones.coverMatrix.MovementCost);
- CollectionAssert.AreEqual(new[] { 2, 1, 0, -1 }, paths[0].Take(4));
- CollectionAssert.AreEqual(new[] { 2, -1 }, paths[2].Take(2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement