/// <summary> /// Follows waypoints, based upon the /// decision model. /// </summary> private void OnFollowWaypoint() { // If we're not close enough, perform the move, // but don't make a waypoint switch decision. if (Vector3.Distance(transform.position, _CurrentWaypoint.transform.position) > WaypointSwitchDistance) { MoveTowards(_CurrentWaypoint.transform.position); return; } switch (WaypointDecision) { // TODO: Implement method to find next connected waypoint of least resistance. case WaypointHabit.FollowNext: _CurrentWaypoint = ChooseNextWaypoint(); break; case WaypointHabit.RandomPoint: _CurrentWaypoint = _CurrentWaypoint.ChooseRandom(); break; default: return; } }
/// <summary> /// Follows waypoints, based upon the /// decision model. /// </summary> private void OnFollowWaypoint() { // If we're not close enough, perform the move, // but don't make a waypoint switch decision. if(Vector3.Distance (transform.position, _CurrentWaypoint.transform.position) > WaypointSwitchDistance) { MoveTowards(_CurrentWaypoint.transform.position); return; } switch(WaypointDecision) { // TODO: Implement method to find next connected waypoint of least resistance. case WaypointHabit.FollowNext: _CurrentWaypoint = ChooseNextWaypoint(); break; case WaypointHabit.RandomPoint: _CurrentWaypoint = _CurrentWaypoint.ChooseRandom(); break; default: return; } }