public void PlayAreaIncrementalUpdateInterrupted(Vector3Int[] displacements) { Debug.Log($"Displacement sequence {displacements.ArrayToString()}"); Vector3Int chunkDimensions = new Vector3Int(16, 16, 16); Vector3Int collidableRadii = new Vector3Int(1, 1, 1); Vector3Int renderedRadii = new Vector3Int(2, 2, 2); //Set up the mocks SetupMocks(chunkDimensions); PlayAreaManager playArea = new PlayAreaManager(collidableRadii, renderedRadii); playArea.UpdateRate = 5;//Limited update rate //Initialise play area playArea.Initialise(mockManager, mockPipeline, player); Vector3Int MaxActiveRadii = playArea.MaximumActiveRadii; Vector3Int originalPlayerChunkId = playArea.playerChunkID; //printStageMap2DSlice(MaxActiveRadii, 0, originalPlayerChunkId); printStageMap2DSlice(MaxActiveRadii, 0, playArea.playerChunkID); for (int i = 0; i < displacements.Length; i++) { player.Position += displacements[i] * chunkDimensions;//move player interrupting progress playArea.Update(); } //remove update limit playArea.UpdateRate = ushort.MaxValue; playArea.Update();//Final update Vector3Int playerChunkIdAfterUpdate = playArea.playerChunkID; Debug.Log("PostUpdate"); //printStageMap2DSlice(MaxActiveRadii, 0, playArea.playerChunkID); //Check play area is correct AssertStatusMapCorrect(MaxActiveRadii, playerChunkIdAfterUpdate, playArea); }
public void PlayAreaUpdateWithLargeDisplacement(int xDisp, int yDisp, int zDisp) { Vector3Int displacement = new Vector3Int(xDisp, yDisp, zDisp) * 10; Debug.Log(displacement); Vector3Int chunkDimensions = new Vector3Int(16, 16, 16); Vector3Int collidableRadii = new Vector3Int(1, 1, 1); Vector3Int renderedRadii = new Vector3Int(2, 2, 2); //Set up the mocks SetupMocks(chunkDimensions); PlayAreaManager playArea = new PlayAreaManager(collidableRadii, renderedRadii); playArea.UpdateRate = ushort.MaxValue;//Unlimited update rate for testing //Initialise play area playArea.Initialise(mockManager, mockPipeline, player); Vector3Int MaxActiveRadii = playArea.MaximumActiveRadii; Vector3Int originalPlayerChunkId = playArea.playerChunkID; player.Position += displacement * chunkDimensions; //Debug.Log("PreUpdate"); //printStageMap2DSlice(MaxActiveRadii, 0, originalPlayerChunkId); playArea.Update(); Vector3Int playerChunkIdAfterUpdate = playArea.playerChunkID; //Ensure player chunk updated correctly Assert.AreEqual(originalPlayerChunkId + displacement, playerChunkIdAfterUpdate, $"Player chunk id was incorrect"); //Debug.Log("PostUpdate"); //printStageMap2DSlice(MaxActiveRadii, 0, playerChunkIdAfterUpdate); //Check play area is correct AssertStatusMapCorrect(MaxActiveRadii, playerChunkIdAfterUpdate, playArea); }