Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.84 KB | None | 0 0
  1. [Test]
  2.         public void MoveTo2_0_from_0_0()
  3.         {
  4.             var cells = player1.GameState.Cells;
  5.             var sectors = player1.GameState.Sectors;
  6.  
  7.             var squadView = player1.ViewState.SquadViews.GetEntities()[0];
  8.             var squadEntity = squadView.squadViewsModelEntity.Value;
  9.  
  10.             var pathfinding = player1.ViewState.ViewSingletones.cellPathfinder.value;
  11.             var paths = squadView.movementMatrix.Paths;
  12.  
  13.             MovementUtility.SyncCellsWithPathfinding(cells, pathfinding);            
  14.             MovementUtility.FillMovementMatrixForSquad(sectors, cells, squadEntity, squadView, pathfinding, player1.GameState.Singletones.coverMatrix.MovementCost);
  15.  
  16.             //0 0 0 0 0
  17.             //0 0 0 0 0
  18.             //0 0 0 0 0
  19.             //0 0 0 0 0
  20.             //x -> t 0 0
  21.  
  22.             //path to 0,0
  23.             CollectionAssert.AreEqual(new[] { 0, -1 }, paths[0].Take(2));
  24.             //path to 2,0
  25.             CollectionAssert.AreEqual(new[] { 0 , 1, 2 , -1 }, paths[2].Take(4));
  26.  
  27.             //0 0 0 0 0
  28.             //0 0 0 0 0
  29.             //0 0 0 0 0
  30.             //0 0 0 0 0
  31.             //t <- x 0 0
  32.            
  33.             //move squad to 2,0,0
  34.             var targetCellId = FieldUtility.GetId(2, 0, 0);
  35.             squadEntity.ReplaceCellReference(targetCellId);
  36.             cells.ById(0).RemoveSquadReference();
  37.             cells.ById(targetCellId).ReplaceSquadReference(0);
  38.  
  39.             MovementUtility.SyncCellsWithPathfinding(cells, pathfinding);
  40.             MovementUtility.FillMovementMatrixForSquad(sectors, cells, squadEntity, squadView, pathfinding, player1.GameState.Singletones.coverMatrix.MovementCost);
  41.  
  42.             CollectionAssert.AreEqual(new[] { 2, 1, 0, -1 }, paths[0].Take(4));
  43.             CollectionAssert.AreEqual(new[] { 2, -1 }, paths[2].Take(2));
  44.  
  45.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement