private void GoToNextLevel() { if (NetworkServer.active && !SceneExitController.isRunning) { SceneCollection startingScenes = initialStartingScenes; if (startingScenes == null || startingScenes.isEmpty) { startingScenes = ScriptableObject.CreateInstance <SceneCollection>(); startingScenes.SetSceneEntries(new SceneCollection.SceneEntry[] { new SceneCollection.SceneEntry { sceneDef = SceneCatalog.GetSceneDefFromSceneName("blackbeach"), weight = 1, }, new SceneCollection.SceneEntry { sceneDef = SceneCatalog.GetSceneDefFromSceneName("golemplains"), weight = 1, }, }); } WeightedSelection <SceneDef> sceneDefs = new WeightedSelection <SceneDef>(); startingScenes.AddToWeightedSelection(sceneDefs); run.PickNextStageScene(sceneDefs); SceneExitController exitController = gameObject.AddComponent <SceneExitController>(); exitController.useRunNextStageScene = true; Debug.Log("Advancing to next stage..."); exitController.Begin(); } }
public void Start() { controller = GetComponent <SceneExitController>(); // special next scene overrides based on the current scene var mostRecentSceneDef = SceneCatalog.mostRecentSceneDef; if (mostRecentSceneDef) { if (destinationOverrides.ContainsKey(mostRecentSceneDef.baseSceneName)) { var possibleOverrides = RoR2Application.rng.NextElementUniform(destinationOverrides[mostRecentSceneDef.baseSceneName]); var sceneOverride = SceneCatalog.FindSceneDef(possibleOverrides); if (sceneOverride) { controller.destinationScene = sceneOverride; } } } // if a teleporter has a next scene override, use it if (TeleporterInteraction.instance) { var sceneExitController = TeleporterInteraction.instance.sceneExitController; if (sceneExitController && !sceneExitController.useRunNextStageScene) { controller.useRunNextStageScene = false; controller.destinationScene = sceneExitController.destinationScene; } } controller.Begin(); }
private void SkipStage(SceneExitController self) { /*I actually dont know what this does * //self = explicitSceneExitController.GetComponent<SceneExitController>(); #if DEBUG * Chat.AddMessage("Turbo Edition: " + EquipmentName + " getComponent " + self); #endif*/ //CANNOT DO THIS!!!! Throws an exception on ExitStage.State newState! //self = new SceneExitController(); InstanceTracker.Add(self); #if DEBUG Chat.AddMessage("Turbo Edition: " + EquipmentName + " forced stage skip."); #endif //The game does this so lets do too if (NetworkServer.active) { //SceneExitController.ExitState == SceneExitController.ExitState.Idle; self.SetState(SceneExitController.ExitState.Idle); self.Begin(); } //If we are grabbing an already existing instance from the game thanks to InstanceTracker.FirstOrNull we are deleting that one //should be fine since we are leaving the scene though. InstanceTracker.Remove(self); }