public void Deactivate() { int count = 0; WirelessNavPoint currentNavPoint = navPoint; while (currentNavPoint != null) { WirelessNavPoint nextNavPoint = currentNavPoint.getNextNavPoint(Controls.getDirection(), currentNavPoint); foreach (GameObject obj in currentNavPoint.associatedDevices) { ShmupSpawnable spawnableObject = obj.GetComponent <ShmupSpawnable>(); if (spawnableObject != null) { spawnableObject.Die(); } } currentNavPoint = nextNavPoint; count++; if (count > 30) { print("deleting nav points probably resulted in a infinite loop"); break; } //if (currentNavPoint.isEndpoint) // break; } }
public override void EndEvent() { foreach (GameObject obj in ObjectsToSpawn) { ShmupSpawnable spawnable = obj.GetComponent <ShmupSpawnable>(); if (spawnable == null) { obj.SetActive(true); } else { spawnable.Spawn(); } } }