private IEnumerator WaitForLevel() { yield return(null); yield return(new WaitWhile(() => LevelAssetsLoader.Instance.isLoadingLevel)); var clone = Instantiate(Prefabs.enemy).GetComponent <Enemy>(); clone.transform.position = transform.position; clone.transform.rotation = transform.rotation; clone.gameObject.SetActive(true); GameObject currentGun = clone.currentGun; Destroy(currentGun); if (startWeapon != WeaponType.None) { GameObject gun = Prefabs.GetWeapon(startWeapon); clone.startGun = gun; clone.GiveGun(); } Destroy(gameObject); }
private IEnumerator WaitForLevel() { yield return(null); yield return(new WaitWhile(() => LevelAssetsLoader.Instance.isLoadingLevel)); var clone = Prefabs.GetWeapon(type); if (clone != null) { clone.transform.position = transform.position; clone.transform.rotation = transform.rotation; clone.SetActive(true); } Destroy(gameObject); }
private IEnumerator WaitForLevel() { yield return(null); yield return(new WaitWhile(() => LevelAssetsLoader.Instance.isLoadingLevel)); Prefabs.player.transform.position = transform.position; Prefabs.player.SetActive(true); Prefabs.camera.SetActive(true); if (startWeapon != WeaponType.None) { GameObject currentGun = Prefabs.GetWeapon(startWeapon); Prefabs.player.GetComponentInChildren <DetectWeapons>().ForcePickup(currentGun); } Destroy(gameObject); }