/// <summary> /// Returns a coroutine that causes *character* to follow the path stored /// in this path object. /// </summary> /// <param name="steering">The steering controller for the character to move along the path</param> /// <returns>A coroutine you can run with StartCoroutine()</returns> public IEnumerator FollowPath(CharacterSteeringController steering) { while (this.WaypointsRemain(steering.Position)) { steering.Seek(this.CurrentWaypoint, Speed); yield return null; } steering.Stop(); }
/// <summary> /// Returns a coroutine that causes *character* to follow the path stored /// in this path object. /// </summary> /// <param name="steering">The steering controller for the character to move along the path</param> /// <returns>A coroutine you can run with StartCoroutine()</returns> public IEnumerator FollowPath(CharacterSteeringController steering) { while (this.WaypointsRemain(steering.Position)) { steering.Seek(this.CurrentWaypoint, Speed); yield return(null); } steering.Stop(); }
/// <summary> /// Updates the character's steering to steer along this path. /// </summary> /// <param name="steering">The steering controller for the character to move along the path</param> /// <returns>Whether the character has arrived at the destination.</returns> public bool UpdateSteering(CharacterSteeringController steering) { if (this.WaypointsRemain(steering.Position)) { steering.Seek(this.CurrentWaypoint, Speed); return false; } steering.Stop(); return true; }
/// <summary> /// Updates the character's steering to steer along this path. /// </summary> /// <param name="steering">The steering controller for the character to move along the path</param> /// <returns>Whether the character has arrived at the destination.</returns> public bool UpdateSteering(CharacterSteeringController steering) { if (this.WaypointsRemain(steering.Position)) { steering.Seek(this.CurrentWaypoint, Speed); return(false); } steering.Stop(); return(true); }