public void Update_PathfindingCompletes_GoalCompletes() { _owner.transform.position = new Vector3(12.0f, 1.0f, 2.0f); _goal.Initialise(); _pathfinding.CompleteDelegate(); Assert.AreEqual(EGoalStatus.Completed, _goal.Update(1.0f)); }
public void CompletesMovement_TimePassesLessThanDelay_StartingPositionNotSetAsTarget() { var initialLocation = _pathfinding.gameObject.transform.position; UnityMessageEventFunctions.InvokeMessageEventWithDispatcher(_pathfinding.gameObject, new SuspiciousObjectSightedMessage(_targetObject)); _goal.Initialise(); _goal.Update(_params.IdleDelayOnDetection + 0.1f); _pathfinding.CompleteDelegate(); _goal.Update(0.0f); _goal.Update(_params.IdleDelayOnObservation * 0.5f); Assert.AreNotEqual(initialLocation, _pathfinding.TargetLocation); }
public void CompletesMovement_TimePassesLessThanDelay_StartingPositionNotSetAsTarget() { var initialLocation = _pathfinding.gameObject.transform.position; var expectedPosition = new Vector3(2.0f, 3.0f, -1.0f); _goal.TestRecordDisturbance(expectedPosition); _goal.Initialise(); _goal.Update(_params.IdleDelayOnDetection + 0.1f); _pathfinding.CompleteDelegate(); _goal.Update(0.0f); _goal.Update(_params.IdleDelayOnObservation * 0.5f); Assert.AreNotEqual(initialLocation, _pathfinding.TargetLocation); }
public IEnumerator Patrolling_PatrolCompletes_AfterIdleTimeAssignsNextPoint() { var closestPoint = new Vector3(1.0f, 2.0f, 0.0f); var furthestPoint = new Vector3(20.0f, 30.0f, 0.0f); _patrol.PatrolPoints.Add(furthestPoint); _patrol.PatrolPoints.Add(closestPoint); _patrol.StartPatrolling(); _pathfinding.CompleteDelegate(); yield return(new WaitForSeconds(_patrol.IdleTimeBetweenPoints + 0.1f)); Assert.AreEqual(_pathfinding.TargetLocation, furthestPoint); }
public void CompletesMovement_TimePassesLessThanDelay_StartingPositionNotSetAsTarget() { var initialLocation = _pathfinding.gameObject.transform.position; var expectedNoise = new NoiseData { NoiseLocation = new Vector3(2.0f, 3.0f, -1.0f) }; UnityMessageEventFunctions.InvokeMessageEventWithDispatcher(_pathfinding.gameObject, new NoiseHeardMessage(expectedNoise)); _goal.Initialise(); _goal.Update(_params.IdleDelayOnDetection + 0.1f); _pathfinding.CompleteDelegate(); _goal.Update(0.0f); _goal.Update(_params.IdleDelayOnObservation * 0.5f); Assert.AreNotEqual(initialLocation, _pathfinding.TargetLocation); }
public void Update_CompletesPathfinding_StatusIsCompleted() { var goal = new MoveToTargetGoal(_pathfinding.gameObject, Vector3.down); goal.Initialise(); _pathfinding.CompleteDelegate(); Assert.AreEqual(EGoalStatus.Completed, goal.Update(1.0f)); }