Game Development Reference
In-Depth Information
this.animation.Play("run");
this.animation["run"].wrapMode = WrapMode.Loop;
}
if (GUI.Button (Rect (20,90,80,20), "Driveway"))
{
graph.AStar(currentNode,waypoints[10]);
currentWP = 0;
this.animation.Play("run");
this.animation["run"].wrapMode = WrapMode.Loop;
}
if (GUI.Button (Rect (20,115,80,20), "Front"))
{
graph.AStar(currentNode,waypoints[9]);
currentWP = 0;
this.animation.Play("run");
this.animation["run"].wrapMode = WrapMode.Loop;
}
}
function Start ()
{
if(waypoints.length > 0)
{
...
//create edges between the waypoints
graph.AddEdge(waypoints[0], waypoints[1]);
graph.AddEdge(waypoints[1], waypoints[2]);
graph.AddEdge(waypoints[2], waypoints[3]);
graph.AddEdge(waypoints[3], waypoints[4]);
graph.AddEdge(waypoints[4], waypoints[5]);
graph.AddEdge(waypoints[5], waypoints[6]);
graph.AddEdge(waypoints[6], waypoints[7]);
graph.AddEdge(waypoints[7], waypoints[8]);
graph.AddEdge(waypoints[8], waypoints[0]);
//and back the other way
graph.AddEdge(waypoints[1], waypoints[0]);
graph.AddEdge(waypoints[2], waypoints[1]);
graph.AddEdge(waypoints[3], waypoints[2]);
graph.AddEdge(waypoints[4], waypoints[3]);
graph.AddEdge(waypoints[5], waypoints[4]);
graph.AddEdge(waypoints[6], waypoints[5]);
graph.AddEdge(waypoints[7], waypoints[6]);
graph.AddEdge(waypoints[8], waypoints[7]);
graph.AddEdge(waypoints[0], waypoints[8]);
//create edges to extra to waypoints
graph.AddEdge(waypoints[0], waypoints[9]);
graph.AddEdge(waypoints[0], waypoints[10]);
graph.AddEdge(waypoints[9], waypoints[10]);
Search Nedrilad ::




Custom Search