WaypointAgent.cs のスクリプト

以下Gitよりダウンロードできます。

WaypointCircuitでパスを決めてキャラクターを動かす最小限モデル · GitHub

WaypointCircuitでパスを決めてキャラクターを動かす最小限モデル. GitHub Gist: instantly share code, notes, and snippets.

右上のRawを押すとソースがでてきますので、提示されたファイル名WaypointAgent.cs で保存

バックアップ

using UnityEngine;
using System.Collections;
using UnityStandardAssets.Utility;

[RequireComponent(typeof(WaypointProgressTracker))]
public class WaypointAgent : MonoBehaviour 
{
	private WaypointProgressTracker tracker = null;

	[SerializeField, Range(0, 10)]
	protected float speed = 1;

	void Start()
	{
		tracker = GetComponent<WaypointProgressTracker>();
	}

	void Update()
	{
		Vector3 targetPosition = tracker.progressPoint.position + tracker.progressPoint.direction;
		transform.position = Vector3.MoveTowards( transform.position, targetPosition, speed * Time.deltaTime);
	}
}

解説動画