Graphics Reference
In-Depth Information
if( distanceBasedSpawnStart && !spawning && aDist<distance
FromCameraToSpawnAt)
{
StartWave(totalAmountToSpawn,timeBetweenSpawns);
spawning=true;
}
}
public void StartWave(int HowMany, float timeBetweenSpawns)
{
spawnCounter=0;
totalAmountToSpawn=HowMany;
// reset
currentObjectNum=0;
CancelInvoke("doSpawn");
InvokeRepeating("doSpawn",timeBetweenSpawns,timeBetweenSpawns);
}
void doSpawn()
{
SpawnObject();
}
public void SpawnObject()
{
if(spawnCounter>=totalAmountToSpawn)
{
// tell your script that the wave is finished here
CancelInvoke("doSpawn");
this.enabled=false;
return;
}
// create an object
tempObj=SpawnController.Instance.SpawnGO(spawnObjectPrefabs
[currentObjectNum],myTransform.position,Quaternion.
identity);
// tell object to reverse its pathfinding, if required
tempObj.SendMessage("SetReversePath", shouldReversePath,
SendMessageOptions.DontRequireReceiver);
// tell spawned object to use this waypoint controller
tempObj.SendMessage("SetWayController",waypointControl,Send
MessageOptions.DontRequireReceiver);
Search WWH ::




Custom Search