public IEnumerator Spy_Local_Position_Observation_OffSet() { var trainingInstanceController = GetDebugSetup(TrainingScenario.GuardAlert); trainingInstanceController.transform.position = new Vector3(100, 100, 100); SetBasicDebug(trainingInstanceController); yield return(new WaitUntil(() => trainingInstanceController.TestSetUpComplete)); var max = StaticFunctions.GetMaxLocalDistance(1); var frontRow = StaticFunctions.NormalisedFloat(-max, max, VectorConversions.GetLocalPosition(trainingInstanceController.TileDict[TileType.SpyTile][0].Position, trainingInstanceController).z); Assert.AreEqual(frontRow, trainingInstanceController.Guards[0].GetComponent <AlertGuardAgent>().GetSpyLocalPositions().Item2); }
public IEnumerator Spy_Nearest_Guards_All_Guards_OffSet() { var trainingInstanceController = GetDebugSetup(TrainingScenario.GuardAlert); SetDebugParameters(trainingInstanceController, 4, 0, 4, 3, false); trainingInstanceController.transform.position = new Vector3(100, 100, 100); yield return(new WaitUntil(() => trainingInstanceController.TestSetUpComplete)); var freeTiles = trainingInstanceController.TileDict[TileType.FreeTiles] .Concat(trainingInstanceController.TileDict[TileType.SpyTile]) .Concat(trainingInstanceController.TileDict[TileType.GuardTiles]).ToList(); var agentPosition1 = freeTiles.First(t => t.Coords == (7, 7)).Position; var agentPosition2 = freeTiles.First(t => t.Coords == (7, 8)).Position; var agentPosition3 = freeTiles.First(t => t.Coords == (7, 9)).Position; trainingInstanceController.Guards[0].transform.position = agentPosition1; trainingInstanceController.Guards[1].transform.position = agentPosition2; trainingInstanceController.Guards[2].transform.position = agentPosition3; var max = StaticFunctions.GetMaxLocalDistance(4); agentPosition1 = VectorConversions.GetLocalPosition(agentPosition1, trainingInstanceController); agentPosition2 = VectorConversions.GetLocalPosition(agentPosition2, trainingInstanceController); agentPosition3 = VectorConversions.GetLocalPosition(agentPosition3, trainingInstanceController); List <float> nearestPosToAgent1 = new List <float>() { StaticFunctions.NormalisedFloat(-max, max, agentPosition1.x), StaticFunctions.NormalisedFloat(-max, max, agentPosition1.z), StaticFunctions.NormalisedFloat(-max, max, agentPosition2.x), StaticFunctions.NormalisedFloat(-max, max, agentPosition2.z), StaticFunctions.NormalisedFloat(-max, max, agentPosition3.x), StaticFunctions.NormalisedFloat(-max, max, agentPosition3.z) }; Assert.AreEqual(nearestPosToAgent1, trainingInstanceController .Spy .GetComponent <SpyAgent>() .GetGuardPositions(3)); }