IEnumerator spawn() { spawning = true; yield return(new WaitForSeconds(10.0f)); NetworkSpawnEntity nse = gameObject.GetComponent <NetworkSpawnEntity>(); for (int i = 0; i < 5; i++) { nse.spawnEnemy(); } spawning = false; }
public void RpcNextLevel() { GameObject.FindGameObjectWithTag("CameraEffects").GetComponent <CameraEffects>().transition(); if (tutorial.active) { tutorial.SetActive(false); threePuzzleLevel.SetActive(true); spawnPointP1 = GameObject.Find("SpawnPoint_P1"); spawnPointP2 = GameObject.Find("SpawnPoint_P2"); try { GameObject p1 = GameObject.Find("GroundPlatformer(Clone)"); for (int i = 0; i < p1.transform.GetChildCount(); i++) { p1.transform.GetChild(i).position = spawnPointP1.transform.position; } GameObject p2 = GameObject.Find("AirDrawer(Clone)"); for (int i = 0; i < p2.transform.GetChildCount(); i++) { p2.transform.GetChild(i).position = spawnPointP2.transform.position; } NetworkSpawnEntity networkSpawner = tutorial.GetComponentInChildren <NetworkSpawnEntity>(); if (networkSpawner) { Debug.Log("gonna spawn"); networkSpawner.spawnCrates(); } } catch (Exception e) { } } else if (threePuzzleLevel.active) { threePuzzleLevel.SetActive(false); lastLevel.SetActive(true); spawnPointP1 = GameObject.Find("SpawnPoint_P1"); spawnPointP2 = GameObject.Find("SpawnPoint_P2"); try { GameObject p1 = GameObject.Find("GroundPlatformer(Clone)"); for (int i = 0; i < p1.transform.GetChildCount(); i++) { p1.transform.GetChild(i).position = spawnPointP1.transform.position; } GameObject p2 = GameObject.Find("AirDrawer(Clone)"); for (int i = 0; i < p2.transform.GetChildCount(); i++) { p2.transform.GetChild(i).position = spawnPointP2.transform.position; } }catch (Exception e) { } } if (lastLevel.active) { GetComponent <DialogueTrigger>().forceSubmit(); } }