Graphics Reference
In-Depth Information
// tell object to use this speed (again with no required
// receiver just in case)
if(shouldSetSpeed)
tempObj.SendMessage("SetSpeed",speedToSet,SendMessage
Options.DontRequireReceiver);
// tell object to use this speed (again with no required
// receiver just in case)
if(shouldSetSmoothing)
tempObj.SendMessage("SetPathSmoothingRate",smoothingToSet,
SendMessageOptions.DontRequireReceiver);
// tell object to use this speed (again with no required
// receiver just in case)
if(shouldSetRotateSpeed)
tempObj.SendMessage("SetRotateSpeed",rotateToSet,SendMessage
Options.DontRequireReceiver);
// increase the 'how many objects we have spawned' counter
spawnCounter++;
// increase the 'which object to spawn' counter
currentObjectNum++;
// check to see if we've reached the end of the spawn
// objects array
if(currentObjectNum> totalSpawnObjects-1 )
currentObjectNum=0;
}
}
4.3.3.1 Script Breakdown
This script derives from MonoBehavior:
public class Path_Spawner : MonoBehavior
{
The Path_Spawner class assumes that you will be able to set a reference to a waypoint
controller in the Unity editor Inspector window (there is currently no interface to do this
through code). If no waypoint controller is referenced, the script will do nothing:
public Waypoints_Controller waypointControl;
After the rest of the variable declarations, the Start() function kicks things of with a
call to Init():
void Start ()
{
Init();
}
Search WWH ::




Custom Search