void OnGUI() { // Create a GUI button to switch to SpaceScene1 if (GUI.Button(new Rect(10, 10, 180, 25), "Switch to Scene 1 (F1)")) { SU_SpaceSceneSwitcher.Switch("SpaceScene1"); } // Create a GUI button to switch to SpaceScene2 if (GUI.Button(new Rect(10, 40, 180, 25), "Switch to Scene 2 (F2)")) { SU_SpaceSceneSwitcher.Switch("SpaceScene2"); } // Switch Camera Follow mode SU_CameraFollow _cameraFollow = Camera.main.GetComponent <SU_CameraFollow>(); if (GUI.Button(new Rect(10, 70, 180, 25), "Camera " + _cameraFollow.followMode.ToString())) { if (_cameraFollow.followMode == SU_CameraFollow.FollowMode.CHASE) { // Set following spectator mode _cameraFollow.followMode = SU_CameraFollow.FollowMode.SPECTATOR; } else { // Set chase view mode _cameraFollow.followMode = SU_CameraFollow.FollowMode.CHASE; } } // Handle Space Particles on/off _spaceParticles = GUI.Toggle(new Rect(10, 100, 180, 25), _spaceParticles, "Space Particles"); if (_oldSpaceParticles != _spaceParticles) { // Use the SU_SpaceSceneSwitcher to set active which takes into consideration compiler specific code SU_SpaceSceneSwitcher.SetActive(spaceParticles.gameObject, _spaceParticles); // Remember the value, workaround for how GUI.Toggle works when you can't perform the if statement on the actual toggle _oldSpaceParticles = _spaceParticles; } // Handle Space Fog on/off _spaceFog = GUI.Toggle(new Rect(10, 130, 180, 25), _spaceFog, "Space Fog"); if (_oldSpaceFog != _spaceFog) { // Use the SU_SpaceSceneSwitcher to set active which takes into consideration compiler specific code SU_SpaceSceneSwitcher.SetActive(spaceFog.gameObject, _spaceFog); // Remember the value, workaround for how GUI.Toggle works when you can't perform the if statement on the actual toggle _oldSpaceFog = _spaceFog; } // Handle Asteroids on/off - when the asteroid object is disabled, it will detect this and disable any active asteroids in the scene _spaceAsteroids = GUI.Toggle(new Rect(10, 160, 180, 25), _spaceAsteroids, "Space Asteroids"); if (_oldSpaceAsteroids != _spaceAsteroids) { // Use the SU_SpaceSceneSwitcher to set active which takes into consideration compiler specific code SU_SpaceSceneSwitcher.SetActive(spaceAsteroids.gameObject, _spaceAsteroids); // Remember the value, workaround for how GUI.Toggle works when you can't perform the if statement on the actual toggle _oldSpaceAsteroids = _spaceAsteroids; } }
// Token: 0x060044BA RID: 17594 RVA: 0x0016FE35 File Offset: 0x0016E235 public static void Switch(int _arrayIndex) { if (SU_SpaceSceneSwitcher.staticSpaceScenes.Count > 0) { SU_SpaceSceneSwitcher.Switch(SU_SpaceSceneSwitcher.staticSpaceScenes[_arrayIndex].name); } }
// Token: 0x060044D0 RID: 17616 RVA: 0x001706E2 File Offset: 0x0016EAE2 private void Update() { if (Input.GetKeyDown(KeyCode.F1)) { SU_SpaceSceneSwitcher.Switch("SpaceScene1"); } if (Input.GetKeyDown(KeyCode.F2)) { SU_SpaceSceneSwitcher.Switch("SpaceScene2"); } }
void Update() { // Hotkey set to F1 to switch to SpaceScene1 if (Input.GetKeyDown(KeyCode.F1)) { SU_SpaceSceneSwitcher.Switch("SpaceScene1"); } // Hotkey set to F2 to switch to SpaceScene1 if (Input.GetKeyDown(KeyCode.F2)) { SU_SpaceSceneSwitcher.Switch("SpaceScene2"); } }
// Token: 0x060044CF RID: 17615 RVA: 0x001704E4 File Offset: 0x0016E8E4 private void OnGUI() { if (GUI.Button(new Rect(10f, 10f, 180f, 25f), "Switch to Scene 1 (F1)")) { SU_SpaceSceneSwitcher.Switch("SpaceScene1"); } if (GUI.Button(new Rect(10f, 40f, 180f, 25f), "Switch to Scene 2 (F2)")) { SU_SpaceSceneSwitcher.Switch("SpaceScene2"); } SU_CameraFollow component = Camera.main.GetComponent <SU_CameraFollow>(); if (GUI.Button(new Rect(10f, 70f, 180f, 25f), "Camera " + component.followMode.ToString())) { if (component.followMode == SU_CameraFollow.FollowMode.CHASE) { component.followMode = SU_CameraFollow.FollowMode.SPECTATOR; } else { component.followMode = SU_CameraFollow.FollowMode.CHASE; } } this._spaceParticles = GUI.Toggle(new Rect(10f, 100f, 180f, 25f), this._spaceParticles, "Space Particles"); if (this._oldSpaceParticles != this._spaceParticles) { SU_SpaceSceneSwitcher.SetActive(this.spaceParticles.gameObject, this._spaceParticles); this._oldSpaceParticles = this._spaceParticles; } this._spaceFog = GUI.Toggle(new Rect(10f, 130f, 180f, 25f), this._spaceFog, "Space Fog"); if (this._oldSpaceFog != this._spaceFog) { SU_SpaceSceneSwitcher.SetActive(this.spaceFog.gameObject, this._spaceFog); this._oldSpaceFog = this._spaceFog; } this._spaceAsteroids = GUI.Toggle(new Rect(10f, 160f, 180f, 25f), this._spaceAsteroids, "Space Asteroids"); if (this._oldSpaceAsteroids != this._spaceAsteroids) { SU_SpaceSceneSwitcher.SetActive(this.spaceAsteroids.gameObject, this._spaceAsteroids); this._oldSpaceAsteroids = this._spaceAsteroids; } }
// Token: 0x060044B9 RID: 17593 RVA: 0x0016FD00 File Offset: 0x0016E100 private void Start() { SU_SpaceSceneSwitcher.staticMode = this.mode; if (this.spaceScenes.Length > 0) { if (SU_SpaceSceneSwitcher.staticSpaceScenes.Count == 0) { for (int i = 0; i < this.spaceScenes.Length; i++) { SU_SpaceSceneSwitcher.staticSpaceScenes.Add(this.spaceScenes[i]); } } } else { Debug.LogError("No Space Scene Prefabs configured for the Space Scene array. Populate array in the inspector with Space Scene prefabs from the Project window. Note! You have to create Prefabs(!) of the space scenes - you cannot assign Unity Scenes to the array."); } if (SU_SpaceSceneSwitcher.staticMode == SU_SpaceSceneSwitcher.Mode.LOAD_ALL_AT_STARTUP) { SU_SpaceSceneSwitcher.hSpaceScenes.Clear(); foreach (GameObject gameObject in this.spaceScenes) { GameObject gameObject2 = (GameObject)AssetManagement.Instantiate(gameObject, new Vector3(0f, 0f, 0f), new Quaternion(0f, 0f, 0f, 0f)); SU_SpaceSceneSwitcher.hSpaceScenes.Add(gameObject.name, gameObject2); SU_SpaceSceneSwitcher.SetActive(gameObject2, false); } } if (this.sceneIndexLoadFirst >= this.spaceScenes.Length) { Debug.LogWarning("Scene Index Load First value is greater than the number of Space Scene prefabs in the array. Loading scene with index 0 instead."); this.sceneIndexLoadFirst = 0; SU_SpaceSceneSwitcher.Switch(this.sceneIndexLoadFirst); } else { SU_SpaceSceneSwitcher.Switch(this.sceneIndexLoadFirst); } }