Beispiel #1
0
        public override void Start()
        {
            // Init Prefab Databases
            ChaosPrefabs.InitCustomPrefabs();
            ChaosRoomPrefabs.InitCustomRooms();

            // Init Custom DungeonFlow(s)
            ChaosDungeonFlows.InitDungeonFlows();

            // Setup Console Commands for Glitch and Chaos stuff
            ETGModMainBehaviour.Instance.gameObject.AddComponent <ChaosConsole>();
            // Modified version of Anywhere mod
            ETGModMainBehaviour.Instance.gameObject.AddComponent <DungeonFlowModule>();

            // Add some of the new enemies to the old secret floors
            ChaosEnemyReplacements.InitReplacementEnemiesForSewers(GlobalDungeonData.ValidTilesets.SEWERGEON, "_Sewers");
            ChaosEnemyReplacements.InitReplacementEnemiesForAbbey(GlobalDungeonData.ValidTilesets.CATHEDRALGEON, "_Abbey");

            ChaosSharedHooks.InstallRequiredHooks();

            GameManager.Instance.OnNewLevelFullyLoaded += ChaosObjectMods.Instance.InitSpecialMods;

            // ETGMod.AIActor.OnPreStart = (Action<AIActor>)Delegate.Combine(ETGMod.AIActor.OnPreStart, new Action<AIActor>(EnemyMods));
            ETGMod.AIActor.OnPreStart += EnemyModRandomizer;

            Debug.Log("[ChaosGlitchMod] Installing GameManager.Awake Hook....");
            Hook gameManagerHook = new Hook(
                typeof(GameManager).GetMethod("Awake", BindingFlags.NonPublic | BindingFlags.Instance),
                typeof(ChaosGlitchMod).GetMethod("GameManager_Awake", BindingFlags.NonPublic | BindingFlags.Instance),
                GameManager.Instance
                );
        }
        private void TransitionToDepart(tk2dSpriteAnimator animator, tk2dSpriteAnimationClip clip)
        {
            if (!m_depatureIsPlayerless)
            {
                if (OverrideTargetFloor == GlobalDungeonData.ValidTilesets.PHOBOSGEON)
                {
                    Pixelator.Instance.RegisterAdditionalRenderPass(ChaosShaders.GlitchScreenShader);
                }
            }

            GameManager.Instance.MainCameraController.DoDelayedScreenShake(departureShake, 0.25f, null);
            if (!m_depatureIsPlayerless)
            {
                for (int i = 0; i < GameManager.Instance.AllPlayers.Length; i++)
                {
                    GameManager.Instance.AllPlayers[i].PrepareForSceneTransition();
                }
                // float delay = 0.5f;
                float delay = 0.7f;
                Pixelator.Instance.FadeToBlack(delay, false, 0f);
                GameUIRoot.Instance.HideCoreUI(string.Empty);
                GameUIRoot.Instance.ToggleLowerPanels(false, false, string.Empty);
                if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.SUPERBOSSRUSH)
                {
                    GameManager.Instance.DelayedLoadBossrushFloor(delay);
                }
                else if (GameManager.Instance.CurrentGameMode == GameManager.GameMode.BOSSRUSH)
                {
                    GameManager.Instance.DelayedLoadBossrushFloor(delay);
                }
                else
                {
                    if (!GameManager.Instance.IsFoyer && GameManager.Instance.CurrentLevelOverrideState == GameManager.LevelOverrideState.NONE)
                    {
                        GlobalDungeonData.ValidTilesets nextTileset = GameManager.Instance.GetNextTileset(GameManager.Instance.Dungeon.tileIndices.tilesetId);
                        GameManager.DoMidgameSave(nextTileset);
                    }
                    if (UsesOverrideTargetFloor)
                    {
                        GlobalDungeonData.ValidTilesets overrideTargetFloor = OverrideTargetFloor;
                        if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.CATACOMBGEON)
                        {
                            GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_catacombs");
                        }
                        else if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.FORGEGEON)
                        {
                            GameManager.Instance.DelayedLoadCustomLevel(delay, "tt_forge");
                        }
                        else if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.OFFICEGEON)
                        {
                            ChaosConsole.elevatorHasBeenUsed = true;
                            if (BraveUtility.RandomBool())
                            {
                                string[] flowPath = new string[] { "custom_glitchchest_flow", "custom_glitchchestalt_flow", "custom_glitch_flow" };
                                ChaosUtility.PrepareGlitchFlow(BraveUtility.RandomElement(flowPath));
                                GameManager.Instance.DelayedLoadNextLevel(delay);
                            }
                            else
                            {
                                string[] flows = new string[] { "custom_glitchchest_flow", "custom_glitchchestalt_flow" };
                                GameManager.Instance.StartCoroutine(ChaosUtility.DelayedGlitchLevelLoad(delay, BraveUtility.RandomElement(flows), useNakatomiTileset: BraveUtility.RandomBool()));
                            }
                        }
                        else if (overrideTargetFloor == GlobalDungeonData.ValidTilesets.PHOBOSGEON)
                        {
                            ChaosUtility.RatDungeon = DungeonDatabase.GetOrLoadByName("Base_ResourcefulRat");
                            ChaosUtility.RatDungeon.LevelOverrideType = GameManager.LevelOverrideState.NONE;
                            // ChaosUtility.RatDungeon.tileIndices.tilesetId = GlobalDungeonData.ValidTilesets.PHOBOSGEON;
                            // ChaosUtility.RatDungeon.tileIndices.tilesetId = GlobalDungeonData.ValidTilesets.JUNGLEGEON;
                            ChaosPrefabs.InitCanyonTileSet(ChaosUtility.RatDungeon, GlobalDungeonData.ValidTilesets.PHOBOSGEON);
                            GameManager.Instance.StartCoroutine(ChaosUtility.DelayedGlitchLevelLoad(delay, "SecretGlitchFloor_Flow", true));
                        }
                        else
                        {
                            GameManager.Instance.DelayedLoadNextLevel(delay);
                        }
                    }
                    else
                    {
                        GameManager.Instance.DelayedLoadNextLevel(delay);
                    }
                    AkSoundEngine.PostEvent("Stop_MUS_All", gameObject);
                }
            }
            elevatorFloor.SetActive(false);
            animator.AnimationCompleted = (Action <tk2dSpriteAnimator, tk2dSpriteAnimationClip>)Delegate.Remove(animator.AnimationCompleted, new Action <tk2dSpriteAnimator, tk2dSpriteAnimationClip>(TransitionToDepart));
            animator.PlayAndDisableObject(elevatorDepartAnimName, null);
        }