Graphics Reference
In-Depth Information
// set our 'winning' distance
// to the distance we just
// found
distance = curDistance;
}
}
}
// now we make sure that we did actually find
// something, then return it
if(closest)
{
// return the waypoint we found in this test
return TEMPindex;
} else {
// no waypoint was found, so return -1 (this
// should be accounted for at the other end!)
return -1;
}
}
public Transform GetWaypoint(int index)
{
if( shouldReverse )
{
// send back the reverse index'd waypoint
index=(transforms.Count-1)-index;
if(index<0)
index=0;
}
// make sure that we have populated the transforms list, if
// not, populate it
if(transforms==null)
GetTransforms();
// first, let's check to see if this index is higher than
// our waypoint count
// if so, we return null which needs to be handled on the
// other side'
if(index>transforms.Count-1)
return null;
return (Transform)transforms[index];
}
public int GetTotal()
{
return totalTransforms;
}
}
After variable declarations, the Start() function calls a function called Get
Transforms().
Search WWH ::




Custom Search