void CmdUserGenerateMapPiece(GameObject piece) { if (mapGenerator.isFrontPiece(piece)) { mapGenerator.GenerateMapPiece(); } }
IEnumerator GenerateMapPiece() { yield return(new WaitForSeconds(10f)); while (true) { if (userGenerated) { userGenerated = false; yield return(new WaitForSeconds(waitTime)); } mapGenerator.GenerateMapPiece(); yield return(new WaitForSeconds(waitTime)); } }
public void GenerateMapPieceDestroysLastPiece() { //Arrange MapGenerationScript mapGeneration = new MapGenerationScript(); var map = GetMapMock(); mapGeneration.SetMapInterface(map); mapGeneration.Start(new GameObject()); Queue <GameObject> queue = (Queue <GameObject>)GetInstanceField(typeof(MapGenerationScript), mapGeneration, "mapQueue"); //Act mapGeneration.GenerateMapPiece(); //Assert map.Received().DestroyThis(queue.Dequeue()); // destroyed last map queue piece }
public void GenerateMapPiece() { //Arrange MapGenerationScript mapGeneration = new MapGenerationScript(); var map = GetMapMock(); mapGeneration.SetMapInterface(map); mapGeneration.Start(new GameObject()); map.ClearReceivedCalls(); //Act mapGeneration.GenerateMapPiece(); //Assert map.Received(1).InstantiateGameObject(Arg.Any<GameObject>(), Arg.Any<Vector3>(), Arg.Any<Quaternion>()); // received only 2 calls, one is instantiate map.Received(1).DestroyThis(Arg.Any<GameObject>()); // one was a destroy call }
public void GenerateMapPiece() { //Arrange MapGenerationScript mapGeneration = new MapGenerationScript(); var map = GetMapMock(); mapGeneration.SetMapInterface(map); mapGeneration.Start(new GameObject()); map.ClearReceivedCalls(); //Act mapGeneration.GenerateMapPiece(); //Assert map.Received(1).InstantiateGameObject(Arg.Any <GameObject>(), Arg.Any <Vector3>(), Arg.Any <Quaternion>()); // received only 2 calls, one is instantiate map.Received(1).DestroyThis(Arg.Any <GameObject>()); // one was a destroy call }
public void GenerateMapPieceDestroysLastPiece() { //Arrange MapGenerationScript mapGeneration = new MapGenerationScript(); var map = GetMapMock(); mapGeneration.SetMapInterface(map); mapGeneration.Start(new GameObject()); Queue<GameObject> queue = (Queue<GameObject>)GetInstanceField(typeof(MapGenerationScript), mapGeneration, "mapQueue"); //Act mapGeneration.GenerateMapPiece(); //Assert map.Received().DestroyThis(queue.Dequeue()); // destroyed last map queue piece }