public void SetRunNextStageToTarget()
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.SeerStationController::SetRunNextStageToTarget()' called on client");
                return;
            }
            SceneDef sceneDef = SceneCatalog.GetSceneDef(this.targetSceneDefIndex);

            if (sceneDef)
            {
                SceneExitController sceneExitController = this.explicitTargetSceneExitController;
                if (!sceneExitController && this.fallBackToFirstActiveExitController)
                {
                    sceneExitController = InstanceTracker.FirstOrNull <SceneExitController>();
                }
                if (sceneExitController)
                {
                    sceneExitController.destinationScene     = sceneDef;
                    sceneExitController.useRunNextStageScene = false;
                    Chat.SendBroadcastChat(new Chat.SimpleChatMessage
                    {
                        baseToken = sceneDef.portalSelectionMessageString
                    });
                }
            }
        }
Exemple #2
0
 public static SceneDef GetSceneDefFromSceneName([NotNull] string name)
 {
     for (int i = 0; i < SceneCatalog.indexToSceneDef.Length; i++)
     {
         SceneDef      sceneDef           = SceneCatalog.indexToSceneDef[i];
         List <string> sceneNameOverrides = sceneDef.sceneNameOverrides;
         if (sceneNameOverrides.Count == 0)
         {
             if (sceneDef.baseSceneName.Equals(name, StringComparison.OrdinalIgnoreCase))
             {
                 return(sceneDef);
             }
         }
         else
         {
             for (int j = 0; j < sceneNameOverrides.Count; j++)
             {
                 if (sceneNameOverrides[j].Equals(name, StringComparison.OrdinalIgnoreCase))
                 {
                     return(sceneDef);
                 }
             }
         }
     }
     return(null);
 }
 // Token: 0x060013D9 RID: 5081 RVA: 0x00054DA0 File Offset: 0x00052FA0
 private void FixedUpdate()
 {
     if (NetworkServer.active)
     {
         if (this.nextStage && this.stageAdvanceTime <= Run.instance.fixedTime)
         {
             SceneDef nextScene = this.nextStage;
             this.nextStage = null;
             Run.instance.AdvanceStage(nextScene);
         }
         if (this.spawnedAnyPlayer && float.IsInfinity(this.stageAdvanceTime) && !Run.instance.isGameOverServer)
         {
             ReadOnlyCollection <PlayerCharacterMasterController> instances = PlayerCharacterMasterController.instances;
             bool flag = false;
             for (int i = 0; i < instances.Count; i++)
             {
                 PlayerCharacterMasterController playerCharacterMasterController = instances[i];
                 if (playerCharacterMasterController.isConnected && playerCharacterMasterController.preventGameOver)
                 {
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 Run.instance.BeginGameOver(GameResultType.Lost);
             }
         }
     }
 }
 public void SetTargetScene(SceneDef sceneDef)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.SeerStationController::SetTargetScene(RoR2.SceneDef)' called on client");
         return;
     }
     this.NetworktargetSceneDefIndex = sceneDef.sceneDefIndex;
 }
Exemple #5
0
 // Token: 0x060015B5 RID: 5557 RVA: 0x0005C77E File Offset: 0x0005A97E
 public override void AdvanceStage(SceneDef nextScene)
 {
     if (this.stageClearCount == 1 && SceneInfo.instance.countsAsStage)
     {
         base.BeginGameOver(GameResultType.Won);
         return;
     }
     base.AdvanceStage(nextScene);
 }
Exemple #6
0
        // Token: 0x060010D1 RID: 4305 RVA: 0x00049A64 File Offset: 0x00047C64
        private void FindStageLogUnlockable()
        {
            SceneDef mostRecentSceneDef = SceneCatalog.mostRecentSceneDef;

            if (mostRecentSceneDef)
            {
                this.unlockableName = SceneCatalog.GetUnlockableLogFromSceneName(mostRecentSceneDef.baseSceneName);
            }
        }
        // Token: 0x060012E1 RID: 4833 RVA: 0x00051118 File Offset: 0x0004F318
        private void OnTargetSceneChanged(SceneDef targetScene)
        {
            Material portalMaterial = null;

            if (targetScene)
            {
                portalMaterial = targetScene.portalMaterial;
            }
            this.SetPortalMaterial(portalMaterial);
        }
 public void BeginAdvanceStage(SceneDef destinationStage)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.Stage::BeginAdvanceStage(RoR2.SceneDef)' called on client");
         return;
     }
     this.NetworkstageAdvanceTime = Run.instance.fixedTime + 0.75f;
     this.nextStage = destinationStage;
 }
        // Token: 0x060012E0 RID: 4832 RVA: 0x000510E0 File Offset: 0x0004F2E0
        public override void OnStartClient()
        {
            base.OnStartClient();
            SceneDef targetScene = null;

            if ((ulong)this.targetSceneDefIndex < (ulong)((long)SceneCatalog.sceneDefCount))
            {
                targetScene = SceneCatalog.GetSceneDef(this.targetSceneDefIndex);
            }
            this.OnTargetSceneChanged(targetScene);
        }
 // Token: 0x060013C9 RID: 5065 RVA: 0x00054926 File Offset: 0x00052B26
 private void Start()
 {
     this.sceneDef = SceneCatalog.GetSceneDefForCurrentScene();
     if (NetworkServer.active)
     {
         this.NetworkstartRunTime = Run.instance.fixedTime;
         this.RespawnAllNPCs();
         this.BeginServer();
     }
     if (NetworkClient.active)
     {
         this.RespawnLocalPlayers();
     }
 }
 // Token: 0x060015D5 RID: 5589 RVA: 0x0006897C File Offset: 0x00066B7C
 private void Start()
 {
     this.sceneDef = SceneCatalog.GetSceneDefForCurrentScene();
     if (NetworkServer.active)
     {
         this.NetworkstartRunTime = Run.instance.fixedTime;
         this.stageSpawnPosition  = this.SampleNodeGraphForSpawnPosition();
         ReadOnlyCollection <CharacterMaster> readOnlyInstancesList = CharacterMaster.readOnlyInstancesList;
         Transform playerSpawnTransform = this.GetPlayerSpawnTransform();
         for (int i = 0; i < readOnlyInstancesList.Count; i++)
         {
             CharacterMaster characterMaster = readOnlyInstancesList[i];
             if (characterMaster && !characterMaster.GetComponent <PlayerCharacterMasterController>() && !characterMaster.GetBodyObject() && characterMaster.gameObject.scene.buildIndex == -1)
             {
                 Vector3    vector   = Vector3.zero;
                 Quaternion rotation = Quaternion.identity;
                 if (playerSpawnTransform)
                 {
                     vector   = playerSpawnTransform.position;
                     rotation = playerSpawnTransform.rotation;
                     BaseAI        component  = readOnlyInstancesList[i].GetComponent <BaseAI>();
                     CharacterBody component2 = readOnlyInstancesList[i].bodyPrefab.GetComponent <CharacterBody>();
                     if (component && component2)
                     {
                         NodeGraph nodeGraph = component.GetNodeGraph();
                         if (nodeGraph)
                         {
                             List <NodeGraph.NodeIndex> list = nodeGraph.FindNodesInRange(vector, 10f, 100f, (HullMask)(1 << (int)component2.hullClassification));
                             if ((float)list.Count > 0f)
                             {
                                 nodeGraph.GetNodePosition(list[UnityEngine.Random.Range(0, list.Count)], out vector);
                             }
                         }
                     }
                 }
                 readOnlyInstancesList[i].Respawn(vector, rotation);
             }
         }
         this.BeginServer();
     }
     if (NetworkClient.active)
     {
         this.RespawnLocalPlayers();
     }
 }
Exemple #12
0
 private static void Init()
 {
     SceneCatalog.indexToSceneDef     = Resources.LoadAll <SceneDef>("SceneDefs/");
     SceneManager.activeSceneChanged += delegate(Scene oldScene, Scene newScene)
     {
         SceneCatalog.currentSceneDef = SceneCatalog.GetSceneDefFromSceneName(newScene.name);
         if (SceneCatalog.currentSceneDef != null)
         {
             SceneCatalog.mostRecentSceneDef = SceneCatalog.currentSceneDef;
             Action <SceneDef> action = SceneCatalog.onMostRecentSceneDefChanged;
             if (action == null)
             {
                 return;
             }
             action(SceneCatalog.mostRecentSceneDef);
         }
     };
     SceneCatalog.currentSceneDef    = SceneCatalog.GetSceneDefFromSceneName(SceneManager.GetActiveScene().name);
     SceneCatalog.mostRecentSceneDef = SceneCatalog.currentSceneDef;
     SceneCatalog.availability.MakeAvailable();
 }
Exemple #13
0
 // Token: 0x06001910 RID: 6416 RVA: 0x0006C164 File Offset: 0x0006A364
 private static void SetSceneDefs(SceneDef[] newSceneDefs)
 {
     SceneCatalog.indexToSceneDef = HGArrayUtilities.Clone <SceneDef>(newSceneDefs);
     for (int i = 0; i < SceneCatalog.indexToSceneDef.Length; i++)
     {
         SceneCatalog.indexToSceneDef[i].sceneDefIndex = i;
     }
     SceneManager.activeSceneChanged += delegate(Scene oldScene, Scene newScene)
     {
         SceneCatalog.currentSceneDef = SceneCatalog.GetSceneDefFromSceneName(newScene.name);
         if (SceneCatalog.currentSceneDef != null)
         {
             SceneCatalog.mostRecentSceneDef = SceneCatalog.currentSceneDef;
             Action <SceneDef> action = SceneCatalog.onMostRecentSceneDefChanged;
             if (action == null)
             {
                 return;
             }
             action(SceneCatalog.mostRecentSceneDef);
         }
     };
     SceneCatalog.currentSceneDef    = SceneCatalog.GetSceneDefFromSceneName(SceneManager.GetActiveScene().name);
     SceneCatalog.mostRecentSceneDef = SceneCatalog.currentSceneDef;
 }
        // Token: 0x06000644 RID: 1604 RVA: 0x00019E18 File Offset: 0x00018018
        private void SetUpSeerStations()
        {
            SceneDef        nextStageScene = Run.instance.nextStageScene;
            List <SceneDef> list           = new List <SceneDef>();

            if (nextStageScene != null)
            {
                int stageOrder = nextStageScene.stageOrder;
                foreach (SceneDef sceneDef in SceneCatalog.allSceneDefs)
                {
                    if (sceneDef.stageOrder == stageOrder)
                    {
                        list.Add(sceneDef);
                    }
                }
            }
            foreach (SeerStationController seerStationController in this.seerStations)
            {
                if (list.Count == 0)
                {
                    seerStationController.GetComponent <PurchaseInteraction>().SetAvailable(false);
                }
                else
                {
                    Util.ShuffleList <SceneDef>(list, this.rng);
                    int      index       = list.Count - 1;
                    SceneDef targetScene = list[index];
                    list.RemoveAt(index);
                    if (this.rng.nextNormalizedFloat < 0.05f)
                    {
                        targetScene = SceneCatalog.GetSceneDefFromSceneName("goldshores");
                    }
                    seerStationController.SetTargetScene(targetScene);
                }
            }
        }
Exemple #15
0
        // Token: 0x06000EB7 RID: 3767 RVA: 0x0004166C File Offset: 0x0003F86C
        private void UpdateState()
        {
            this.stGameplaySongChoice.valueId     = CommonWwiseIds.none;
            this.stMusicSystem.valueId            = CommonWwiseIds.none;
            this.stMusicMenu.valueId              = CommonWwiseIds.none;
            this.stBossStatus.valueId             = CommonWwiseIds.none;
            this.rtpcTeleporterPlayerStatus.value = 1f;
            SceneDef mostRecentSceneDef = SceneCatalog.mostRecentSceneDef;

            if (mostRecentSceneDef)
            {
                string baseSceneName = mostRecentSceneDef.baseSceneName;
                if (baseSceneName == "title")
                {
                    this.stMusicSystem.valueId = CommonWwiseIds.menu;
                    this.stMusicMenu.valueId   = CommonWwiseIds.main;
                    return;
                }
                if (baseSceneName == "lobby")
                {
                    this.stMusicSystem.valueId = CommonWwiseIds.menu;
                    this.stMusicMenu.valueId   = CommonWwiseIds.main;
                    return;
                }
                if (baseSceneName == "logbook")
                {
                    this.stMusicSystem.valueId = CommonWwiseIds.menu;
                    this.stMusicMenu.valueId   = CommonWwiseIds.logbook;
                    return;
                }
                if (baseSceneName == "crystalworld")
                {
                    this.stMusicSystem.valueId = CommonWwiseIds.menu;
                    this.stMusicMenu.valueId   = CommonWwiseIds.logbook;
                    return;
                }
                if (baseSceneName == "bazaar")
                {
                    this.stMusicSystem.valueId = CommonWwiseIds.secretLevel;
                    return;
                }
                this.stMusicSystem.valueId = CommonWwiseIds.gameplay;
                if (mostRecentSceneDef)
                {
                    this.stGameplaySongChoice.valueId = AkSoundEngine.GetIDFromString(mostRecentSceneDef.songName);
                }
                if (TeleporterInteraction.instance && !TeleporterInteraction.instance.isIdle)
                {
                    this.stGameplaySongChoice.valueId = AkSoundEngine.GetIDFromString(mostRecentSceneDef.bossSongName);
                    this.stBossStatus.valueId         = CommonWwiseIds.alive;
                    this.stMusicSystem.valueId        = CommonWwiseIds.bossfight;
                    if (TeleporterInteraction.instance.isIdleToCharging || TeleporterInteraction.instance.isCharging)
                    {
                        if (this.target)
                        {
                            this.rtpcTeleporterPlayerStatus.value = 0f;
                            if (TeleporterInteraction.instance.IsInChargingRange(this.target))
                            {
                                this.rtpcTeleporterPlayerStatus.value = 1f;
                                return;
                            }
                        }
                    }
                    else if (TeleporterInteraction.instance.isCharged)
                    {
                        this.stBossStatus.valueId = CommonWwiseIds.dead;
                    }
                }
            }
        }
        // Token: 0x060011DC RID: 4572 RVA: 0x000586C0 File Offset: 0x000568C0
        private void UpdateState()
        {
            string in_pszState  = "None";
            string in_pszState2 = "None";
            string in_pszState3 = "None";
            string in_pszState4 = "None";

            this.rtpcTeleporterPlayerStatus = 1f;
            SceneDef mostRecentSceneDef = SceneCatalog.mostRecentSceneDef;

            if (mostRecentSceneDef)
            {
                string sceneName = mostRecentSceneDef.sceneName;
                if (!(sceneName == "title"))
                {
                    if (!(sceneName == "lobby"))
                    {
                        if (!(sceneName == "logbook"))
                        {
                            if (!(sceneName == "crystalworld"))
                            {
                                if (!(sceneName == "bazaar"))
                                {
                                    in_pszState2 = "Gameplay";
                                    if (mostRecentSceneDef)
                                    {
                                        in_pszState = mostRecentSceneDef.songName;
                                    }
                                    if (TeleporterInteraction.instance && !TeleporterInteraction.instance.isIdle)
                                    {
                                        in_pszState  = mostRecentSceneDef.bossSongName;
                                        in_pszState4 = "alive";
                                        in_pszState2 = "Bossfight";
                                        if (TeleporterInteraction.instance.isIdleToCharging || TeleporterInteraction.instance.isCharging)
                                        {
                                            if (this.target)
                                            {
                                                this.rtpcTeleporterPlayerStatus = 0f;
                                                if (TeleporterInteraction.instance.IsInChargingRange(this.target))
                                                {
                                                    this.rtpcTeleporterPlayerStatus = 1f;
                                                }
                                            }
                                        }
                                        else if (TeleporterInteraction.instance.isCharged)
                                        {
                                            in_pszState4 = "dead";
                                        }
                                    }
                                }
                                else
                                {
                                    in_pszState2 = "SecretLevel";
                                }
                            }
                            else
                            {
                                in_pszState2 = "Menu";
                                in_pszState3 = "Logbook";
                            }
                        }
                        else
                        {
                            in_pszState2 = "Menu";
                            in_pszState3 = "Logbook";
                        }
                    }
                    else
                    {
                        in_pszState2 = "Menu";
                        in_pszState3 = "Main";
                    }
                }
                else
                {
                    in_pszState2 = "Menu";
                    in_pszState3 = "Main";
                }
            }
            AkSoundEngine.SetState("Music_system", in_pszState2);
            AkSoundEngine.SetState("gameplaySongChoice", in_pszState);
            AkSoundEngine.SetState("Music_menu", in_pszState3);
            AkSoundEngine.SetState("bossStatus", in_pszState4);
        }