void OnLevelFinishedLoading(Scene scene, LoadSceneMode mode) { Debug.Log("Level Loaded"); // Reload stuff after scene changes // Find the number of enemies to spawn spawnnumber = waveDesign [currRound].amtZombies; spawnInterval = waveDesign [currRound].spawnInterval; // localZombCounter is counting from 0 to spawnnumber localZombCounter = 0; ZombiesDestroyed = 0; // Re-find spawn points spawnPoints = GameObject.FindGameObjectsWithTag("spawn"); // Reload saved on scene load WC WCobj = GameObject.FindGameObjectWithTag("WC"); WC = WCobj.GetComponent <WepController> (); // Instantiate sqr GameObject square = GameObject.FindGameObjectWithTag("selector"); if (square != null) { Instantiate(square, new Vector2(0, 12), Quaternion.identity); } // Gotta do this since the scene start is not run since the gamecontroller is not destroyed on load spawnPlayer(); }
// Use this for initialization void Start() { timetowait = 0.7; // Find Wep Controller WepController = GameObject.FindGameObjectWithTag("WC"); WC = WepController.GetComponent <WepController>(); weaponSelect = WC.weaponchoice; }
// Use this for initialization void Start() { WCobj = GameObject.FindGameObjectWithTag("WC"); WC = WCobj.GetComponent <WepController> (); // Find each weapon to appear in mystery box GameObject wep1 = GameObject.FindGameObjectWithTag("keep1"); GameObject wep2 = GameObject.FindGameObjectWithTag("keep2"); GameObject wep3 = GameObject.FindGameObjectWithTag("keep3"); GameObject wep4 = GameObject.FindGameObjectWithTag("keep4"); GameObject wep5 = GameObject.FindGameObjectWithTag("keep5"); GameObject wep6 = GameObject.FindGameObjectWithTag("keep6"); Debug.Log(wep1.name + wep2.name + wep3.name + wep4.name + wep5.name + wep6.name + "s"); // Mystery Box sound aud = GetComponent <AudioSource>(); boxtime = 14f; timeElapsed = 14f; costOfBox = 950; }
void Start() { spawnPlayer(); lastSpawnTime = Time.time; // Find objects needed for first level spawnPoints = GameObject.FindGameObjectsWithTag("spawn"); // Find enemy prefab enemy = GameObject.FindGameObjectWithTag("enemy"); // Initialize to start wave 0 cleanslate(); // Find the number of enemies to spawn spawnnumber = waveDesign [currRound].amtZombies; spawnInterval = waveDesign [currRound].spawnInterval; // Counter initialized localZombCounter = 0; // Final Level prevents overflow (hard-coded since using a list not an array) finalLevel = 5; // Audio sounds = GetComponents <AudioSource>(); noise1 = sounds[0]; noise2 = sounds[1]; // WC WCobj = GameObject.FindGameObjectWithTag("WC"); WC = WCobj.GetComponent <WepController> (); // Play at beginning noise2.Play(); }