public void LoadScene(string SceneName) { if (transitionerObj == null) { transitionerObj = FindObjectOfType <LevelTransitioner>().gameObject; if (transitionerObj == null) { SceneManager.LoadScene(SceneName); } else { transitioner = transitionerObj.GetComponent <LevelTransitioner>(); transitioner.LoadScene(SceneName); } } else { if (transitionerObj.GetComponent <LevelTransitioner>() != null) { transitioner = transitionerObj.GetComponent <LevelTransitioner>(); transitioner.LoadScene(SceneName); } } }
public void LoadScene(int SceneID) { if (transitionerObj != null) { if (transitionerObj.GetComponent <LevelTransitioner>() != null) { transitioner = transitionerObj.GetComponent <LevelTransitioner>(); transitioner.LoadScene(SceneID); } } else { SceneManager.LoadScene(SceneID); } }
public void LoadRandomGameLevel() { int levelID = UnityEngine.Random.Range(0, Enum.GetNames(typeof(GameLevels)).Length - 1); string levelName = Enum.GetName(typeof(GameLevels), levelID); if (transitionerObj != null) { if (transitionerObj.GetComponent <LevelTransitioner>() != null) { transitioner = transitionerObj.GetComponent <LevelTransitioner>(); } transitioner.LoadScene(levelName, true); } else { PhotonNetwork.LoadLevel(levelName); } }
void Start() { if (instance != null) { Destroy(this.gameObject); } instance = this; DontDestroyOnLoad(this.gameObject); sr = GetComponent <SpriteRenderer>(); GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); foreach (GameObject p in players) { if (p.GetComponent <PlayerMovement>().isActive) { player = p; } } //this.transform.position = player.transform.position; DisableTransition(); }