示例#1
0
        private void PlaceRandomCorpses(Dungeon dungeon, RoomHandler currentRoom, ExpandObjectDatabase objectDatabase, int RandomObjectsPlaced, int RandomObjectsSkipped)
        {
            PrototypeDungeonRoom.RoomCategory roomCategory = currentRoom.area.PrototypeRoomCategory;

            int MaxObjectsPerRoom = 12;

            if (currentRoom != null && !string.IsNullOrEmpty(currentRoom.GetRoomName()) && !currentRoom.IsMaintenanceRoom() &&
                !currentRoom.GetRoomName().StartsWith("Boss Foyer"))
            {
                if (Random.value <= 0.6f && roomCategory != PrototypeDungeonRoom.RoomCategory.ENTRANCE && roomCategory != PrototypeDungeonRoom.RoomCategory.REWARD)
                {
                    List <IntVector2> m_CachedPositions = new List <IntVector2>();
                    int MaxCorpseCount = MaxObjectsPerRoom;
                    if (Random.value <= 0.3f)
                    {
                        MaxCorpseCount = 20;
                    }
                    else if (roomCategory == PrototypeDungeonRoom.RoomCategory.BOSS)
                    {
                        MaxCorpseCount = 17;
                    }

                    int CorpseCount = Random.Range(6, MaxObjectsPerRoom);

                    for (int i = 0; i < CorpseCount; i++)
                    {
                        IntVector2?RandomVector = GetRandomAvailableCell(dungeon, currentRoom, m_CachedPositions);

                        if (RandomVector.HasValue)
                        {
                            if (Random.value <= 0.08f)
                            {
                                GameObject SkeletonCorpse = Instantiate(ExpandPrefabs.Sarco_Skeleton, RandomVector.Value.ToVector3(), Quaternion.identity);
                                SkeletonCorpse.GetComponent <tk2dSprite>().HeightOffGround = -1;
                                SkeletonCorpse.GetComponent <tk2dSprite>().UpdateZDepth();
                                SkeletonCorpse.transform.parent = currentRoom.hierarchyParent;
                                RandomObjectsPlaced++;
                            }
                            else
                            {
                                GameObject WrithingBulletManCorpse = objectDatabase.WrithingBulletman.InstantiateObject(currentRoom, (RandomVector.Value - currentRoom.area.basePosition));
                                WrithingBulletManCorpse.transform.parent = currentRoom.hierarchyParent;
                                RandomObjectsPlaced++;
                            }
                            if (m_CachedPositions.Count <= 0)
                            {
                                break;
                            }
                        }
                        else
                        {
                            RandomObjectsSkipped++;
                        }
                    }
                }
            }
        }
示例#2
0
        public void SpawnRockslides(PlayerController user)
        {
            spriteAnimator.Play("Activate");
            if (user.CurrentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear))
            {
                ExpandObjectDatabase objectDatabase = new ExpandObjectDatabase();

                int EnemyCount = Random.Range(1, user.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear).Count);
                // Set a cap incase there's an insane amount of enemies in the room and it chose a very large value.

                if (Random.value <= 0.35f)
                {
                    EnemyCount = user.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear).Count;
                }
                else if (EnemyCount > 3 && Random.value <= 0.5f)
                {
                    EnemyCount = 3;
                }

                if (EnemyCount > 10)
                {
                    EnemyCount = 10;
                }

                List <AIActor> SelectedEnemies = new List <AIActor>();
                foreach (AIActor enemy in user.CurrentRoom.GetActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear))
                {
                    SelectedEnemies.Add(enemy);
                }

                for (int i = 0; i < EnemyCount; i++)
                {
                    if (SelectedEnemies.Count <= 0)
                    {
                        break;
                    }

                    AIActor TargetEnemy = BraveUtility.RandomElement(SelectedEnemies);

                    if (TargetEnemy && !TargetEnemy.healthHaver.IsDead)
                    {
                        Vector2 SelectedEnemyPosition = TargetEnemy.specRigidbody.GetUnitCenter(ColliderType.Ground);
                        StartCoroutine(HandleTriggerRockSlide(user, objectDatabase.Mines_Cave_In, SelectedEnemyPosition));
                        SelectedEnemies.Remove(TargetEnemy);
                    }
                }
                objectDatabase = null;
            }
        }
        private void HandleHideKeyOnTable()
        {
            ExpandObjectDatabase objectDatabase         = new ExpandObjectDatabase();
            IntVector2           GlitchedTable1Position = new IntVector2(9, 10);
            IntVector2           GlitchedTable2Position = new IntVector2(9, 8);
            GameObject           GlitchedVerticalTable1 = ExpandUtility.GenerateDungeonPlacable(objectDatabase.TableVertical, false, true).InstantiateObject(m_ParentRoom, GlitchedTable1Position);
            GameObject           GlitchedVerticalTable2 = ExpandUtility.GenerateDungeonPlacable(objectDatabase.TableVertical, false, true).InstantiateObject(m_ParentRoom, GlitchedTable2Position);

            GlitchedVerticalTable1.transform.SetParent(m_ParentRoom.hierarchyParent, true);
            GlitchedVerticalTable2.transform.SetParent(m_ParentRoom.hierarchyParent, true);

            GlitchedVerticalTable1.AddComponent <ExpandKickableObject>();
            GlitchedVerticalTable2.AddComponent <ExpandKickableObject>();

            float RandomIntervalFloat       = UnityEngine.Random.Range(0.02f, 0.06f);
            float RandomDispFloat           = UnityEngine.Random.Range(0.1f, 0.16f);
            float RandomDispIntensityFloat  = UnityEngine.Random.Range(0.1f, 0.2f);
            float RandomColorProbFloat      = UnityEngine.Random.Range(0.05f, 0.2f);
            float RandomColorIntensityFloat = UnityEngine.Random.Range(0.1f, 0.22f);

            if (BraveUtility.RandomBool())
            {
                ExpandKickableObject GlitchedTable1Component = GlitchedVerticalTable1.GetComponent <ExpandKickableObject>();
                GlitchedTable1Component.SpawnedObject             = PickupObjectDatabase.GetById(727).gameObject;
                GlitchedTable1Component.willDefinitelyExplode     = true;
                GlitchedTable1Component.spawnObjectOnSelfDestruct = true;
                ExpandShaders.Instance.ApplyGlitchShader(GlitchedTable1Component.GetComponentInChildren <tk2dBaseSprite>(), true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat);
            }
            else
            {
                ExpandKickableObject GlitchedTable1Component = GlitchedVerticalTable2.GetComponent <ExpandKickableObject>();
                GlitchedTable1Component.SpawnedObject             = PickupObjectDatabase.GetById(727).gameObject;
                GlitchedTable1Component.willDefinitelyExplode     = true;
                GlitchedTable1Component.spawnObjectOnSelfDestruct = true;
                ExpandShaders.Instance.ApplyGlitchShader(GlitchedTable1Component.GetComponentInChildren <tk2dBaseSprite>(), true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat);
            }
            m_ParentRoom.RegisterInteractable(GlitchedVerticalTable1.GetComponentInChildren <FlippableCover>());
            m_ParentRoom.RegisterInteractable(GlitchedVerticalTable2.GetComponentInChildren <FlippableCover>());
            m_ParentRoom.RegisterInteractable(GlitchedVerticalTable1.GetComponent <ExpandKickableObject>());
            m_ParentRoom.RegisterInteractable(GlitchedVerticalTable2.GetComponent <ExpandKickableObject>());
        }
        private void HandleChestRoomSetup()
        {
            AssetBundle          sharedAssets1  = ResourceManager.LoadAssetBundle("shared_auto_001");
            AssetBundle          sharedAssets2  = ResourceManager.LoadAssetBundle("shared_auto_002");
            ExpandObjectDatabase objectDatabase = new ExpandObjectDatabase();

            try {
                DungeonPlaceable ChestPlatform = sharedAssets2.LoadAsset <DungeonPlaceable>("Treasure_Dais_Stone_Carpet");
                GameObject       Chest_Black   = sharedAssets1.LoadAsset <GameObject>("Chest_Black");
                GameObject       Chest_Rainbow = sharedAssets1.LoadAsset <GameObject>("Chest_Rainbow");
                GameObject       Chest_Rat     = sharedAssets1.LoadAsset <GameObject>("Chest_Rat");

                IntVector2 TreasureChestCarpetPosition1 = new IntVector2(8, 29);
                IntVector2 TreasureChestCarpetPosition2 = new IntVector2(8, 54);
                IntVector2 SecretChestPosition1         = new IntVector2(8, 31);
                IntVector2 SecretChestPosition2         = new IntVector2(8, 56);
                GameObject TreasureChestStoneCarpet1    = ChestPlatform.InstantiateObject(m_ParentRoom, TreasureChestCarpetPosition1);
                GameObject TreasureChestStoneCarpet2    = ChestPlatform.InstantiateObject(m_ParentRoom, TreasureChestCarpetPosition2);
                TreasureChestStoneCarpet1.transform.position -= new Vector3(0.55f, 0);
                TreasureChestStoneCarpet2.transform.position -= new Vector3(0.55f, 0);
                TreasureChestStoneCarpet1.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                TreasureChestStoneCarpet2.transform.SetParent(m_ParentRoom.hierarchyParent, true);

                GameObject PlacedBlackChestObject   = ExpandUtility.GenerateDungeonPlacable(Chest_Black, false, true).InstantiateObject(m_ParentRoom, SecretChestPosition1);
                GameObject PlacedRainbowChestObject = ExpandUtility.GenerateDungeonPlacable(Chest_Rainbow, false, true).InstantiateObject(m_ParentRoom, SecretChestPosition2);
                PlacedBlackChestObject.transform.position    += new Vector3(0.5f, 0);
                PlacedRainbowChestObject.transform.position  += new Vector3(0.5f, 0);
                TreasureChestStoneCarpet1.transform.position += new Vector3(0.5f, 0);
                TreasureChestStoneCarpet2.transform.position += new Vector3(0.5f, 0);
                PlacedBlackChestObject.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PlacedRainbowChestObject.transform.SetParent(m_ParentRoom.hierarchyParent, true);

                tk2dBaseSprite PlacedBlackChestSprite = PlacedBlackChestObject.GetComponentInChildren <tk2dBaseSprite>();

                GenericLootTable BlackChestLootTable = GameManager.Instance.RewardManager.ItemsLootTable;

                Chest PlacedBlackChestComponent   = PlacedBlackChestObject.GetComponent <Chest>();
                Chest PlacedRainbowChestComponent = PlacedRainbowChestObject.GetComponent <Chest>();
                PlacedBlackChestComponent.ChestType           = Chest.GeneralChestType.ITEM;
                PlacedBlackChestComponent.lootTable.lootTable = BlackChestLootTable;
                bool LootTableCheck = PlacedBlackChestComponent.lootTable.canDropMultipleItems && PlacedBlackChestComponent.lootTable.overrideItemLootTables != null && PlacedBlackChestComponent.lootTable.overrideItemLootTables.Count > 0;
                if (LootTableCheck)
                {
                    PlacedBlackChestComponent.lootTable.overrideItemLootTables[0] = BlackChestLootTable;
                }
                PlacedBlackChestComponent.overrideMimicChance = 0f;
                PlacedBlackChestComponent.ForceUnlock();
                PlacedBlackChestComponent.PreventFuse = true;
                PlacedRainbowChestComponent.ForceUnlock();
                PlacedRainbowChestComponent.PreventFuse = true;
                m_ParentRoom.RegisterInteractable(PlacedBlackChestComponent);
                m_ParentRoom.RegisterInteractable(PlacedRainbowChestComponent);

                Vector3    SpecialLockedDoorPosition = (new Vector3(9, 52.25f) + m_ParentRoom.area.basePosition.ToVector3());
                GameObject SpecialLockedDoor         = Instantiate(objectDatabase.LockedJailDoor, SpecialLockedDoorPosition, Quaternion.identity);
                SpecialLockedDoor.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                InteractableLock SpecialLockedDoorComponent = SpecialLockedDoor.GetComponentInChildren <InteractableLock>();
                SpecialLockedDoorComponent.lockMode      = InteractableLock.InteractableLockMode.RESOURCEFUL_RAT;
                SpecialLockedDoorComponent.JailCellKeyId = 0;
                tk2dBaseSprite RainbowLockSprite = SpecialLockedDoorComponent.GetComponentInChildren <tk2dBaseSprite>();
                if (RainbowLockSprite != null)
                {
                    ExpandShaders.Instance.ApplyRainbowShader(RainbowLockSprite);
                }

                IntVector2 PuzzleChestPosition1       = new IntVector2(4, 19);
                IntVector2 PuzzleChestPosition2       = new IntVector2(12, 19);
                IntVector2 PuzzleChestPosition3       = new IntVector2(4, 40);
                IntVector2 PuzzleChestPosition4       = new IntVector2(12, 40);
                IntVector2 PuzzleChestPosition5       = new IntVector2(4, 50);
                IntVector2 PuzzleChestPosition6       = new IntVector2(12, 50);
                IntVector2 PuzzleChestCarpetPosition1 = (PuzzleChestPosition1 - new IntVector2(0, 1));
                IntVector2 PuzzleChestCarpetPosition2 = (PuzzleChestPosition2 - new IntVector2(0, 1));
                IntVector2 PuzzleChestCarpetPosition3 = (PuzzleChestPosition3 - new IntVector2(0, 1));
                IntVector2 PuzzleChestCarpetPosition4 = (PuzzleChestPosition4 - new IntVector2(0, 1));
                IntVector2 PuzzleChestCarpetPosition5 = (PuzzleChestPosition5 - new IntVector2(0, 1));
                IntVector2 PuzzleChestCarpetPosition6 = (PuzzleChestPosition6 - new IntVector2(0, 1));

                GameObject PlacedPuzzleRatChest1   = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition1, false, true);
                GameObject PlacedPuzzleRatChest2   = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition2, false, true);
                GameObject PlacedPuzzleRatChest3   = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition3, false, true);
                GameObject PlacedPuzzleRatChest4   = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition4, false, true);
                GameObject PlacedPuzzleRatChest5   = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition5, false, true);
                GameObject PlacedPuzzleRatChest6   = ExpandUtility.GenerateDungeonPlacable(Chest_Rat, false, true).InstantiateObject(m_ParentRoom, PuzzleChestPosition6, false, true);
                GameObject PuzzleChestStoneCarpet1 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition1);
                GameObject PuzzleChestStoneCarpet2 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition2);
                GameObject PuzzleChestStoneCarpet3 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition3);
                GameObject PuzzleChestStoneCarpet4 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition4);
                GameObject PuzzleChestStoneCarpet5 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition5);
                GameObject PuzzleChestStoneCarpet6 = ChestPlatform.InstantiateObject(m_ParentRoom, PuzzleChestCarpetPosition6);
                PlacedPuzzleRatChest1.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PlacedPuzzleRatChest2.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PlacedPuzzleRatChest3.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PlacedPuzzleRatChest4.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PlacedPuzzleRatChest5.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PlacedPuzzleRatChest6.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PuzzleChestStoneCarpet1.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PuzzleChestStoneCarpet2.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PuzzleChestStoneCarpet3.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PuzzleChestStoneCarpet4.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PuzzleChestStoneCarpet5.transform.SetParent(m_ParentRoom.hierarchyParent, true);
                PuzzleChestStoneCarpet6.transform.SetParent(m_ParentRoom.hierarchyParent, true);

                Chest PuzzleRatChest1Component = PlacedPuzzleRatChest1.GetComponent <Chest>();
                Chest PuzzleRatChest2Component = PlacedPuzzleRatChest2.GetComponent <Chest>();
                Chest PuzzleRatChest3Component = PlacedPuzzleRatChest3.GetComponent <Chest>();
                Chest PuzzleRatChest4Component = PlacedPuzzleRatChest4.GetComponent <Chest>();
                Chest PuzzleRatChest5Component = PlacedPuzzleRatChest5.GetComponent <Chest>();
                Chest PuzzleRatChest6Component = PlacedPuzzleRatChest6.GetComponent <Chest>();
                PuzzleRatChest1Component.PreventFuse         = true;
                PuzzleRatChest2Component.PreventFuse         = true;
                PuzzleRatChest3Component.PreventFuse         = true;
                PuzzleRatChest4Component.PreventFuse         = true;
                PuzzleRatChest5Component.PreventFuse         = true;
                PuzzleRatChest6Component.PreventFuse         = true;
                PuzzleRatChest1Component.overrideMimicChance = 0f;
                PuzzleRatChest2Component.overrideMimicChance = 0f;
                PuzzleRatChest3Component.overrideMimicChance = 0f;
                PuzzleRatChest4Component.overrideMimicChance = 0f;
                PuzzleRatChest5Component.overrideMimicChance = 0f;
                PuzzleRatChest6Component.overrideMimicChance = 0f;

                float Seed = UnityEngine.Random.value;

                if (Seed <= 0.5f)
                {
                    PuzzleRatChest1Component.forceContentIds = new List <int> {
                        68
                    };
                    PuzzleRatChest2Component.forceContentIds = new List <int> {
                        727, 727
                    };
                }
                else
                {
                    PuzzleRatChest1Component.forceContentIds = new List <int> {
                        727, 727
                    };
                    PuzzleRatChest2Component.forceContentIds = new List <int> {
                        68
                    };
                }
                if (BraveUtility.RandomBool())
                {
                    PuzzleRatChest3Component.forceContentIds = new List <int> {
                        70, 70, 70, 70
                    };
                    PuzzleRatChest4Component.forceContentIds = new List <int> {
                        727, 727
                    };
                }
                else
                {
                    PuzzleRatChest3Component.forceContentIds = new List <int> {
                        727, 727
                    };
                    PuzzleRatChest4Component.forceContentIds = new List <int> {
                        70, 70, 70, 70
                    };
                }
                if (BraveUtility.RandomBool())
                {
                    PuzzleRatChest5Component.forceContentIds = new List <int> {
                        74
                    };
                    PuzzleRatChest6Component.forceContentIds = new List <int> {
                        316
                    };
                }
                else
                {
                    PuzzleRatChest5Component.forceContentIds = new List <int> {
                        316
                    };
                    PuzzleRatChest6Component.forceContentIds = new List <int> {
                        74
                    };
                }

                PuzzleRatChest1Component.ConfigureOnPlacement(m_ParentRoom);
                PuzzleRatChest2Component.ConfigureOnPlacement(m_ParentRoom);
                PuzzleRatChest3Component.ConfigureOnPlacement(m_ParentRoom);
                PuzzleRatChest4Component.ConfigureOnPlacement(m_ParentRoom);
                PuzzleRatChest5Component.ConfigureOnPlacement(m_ParentRoom);
                PuzzleRatChest6Component.ConfigureOnPlacement(m_ParentRoom);
                m_ParentRoom.RegisterInteractable(PuzzleRatChest1Component);
                m_ParentRoom.RegisterInteractable(PuzzleRatChest2Component);
                m_ParentRoom.RegisterInteractable(PuzzleRatChest3Component);
                m_ParentRoom.RegisterInteractable(PuzzleRatChest4Component);
                m_ParentRoom.RegisterInteractable(PuzzleRatChest5Component);
                m_ParentRoom.RegisterInteractable(PuzzleRatChest6Component);

                Vector3 InfoSignPosition = (new Vector3(6, 4) + m_ParentRoom.area.basePosition.ToVector3());

                GameObject ChestPuzzleInfoSign = Instantiate(ExpandPrefabs.Jungle_BlobLostSign, InfoSignPosition, Quaternion.identity);
                ChestPuzzleInfoSign.name = "Lunk's Minigame Sign";
                ChestPuzzleInfoSign.GetComponent <ExpandNoteDoer>().stringKey = "A minigame Lunk created based on a game he used to play in a land far away.\nGuess the right chest to continue forward.\n If you can guess the correct chest 3 times, the ultimate prize shall be gained!";
                m_ParentRoom.RegisterInteractable(ChestPuzzleInfoSign.GetComponent <ExpandNoteDoer>());
            } catch (Exception ex) {
                if (ExpandStats.debugMode)
                {
                    string Message = "[ExpandTheGungeon] Warning: Exception caught in ExpandWestPuzzleRoomController.HandleChestRoomSetup!";
                    ETGModConsole.Log(Message);
                    Debug.Log(Message);
                    Debug.LogException(ex);
                }
            }
            sharedAssets1  = null;
            sharedAssets2  = null;
            objectDatabase = null;
        }
示例#5
0
        public override void Start()
        {
            if (!string.IsNullOrEmpty(ExceptionText) | !string.IsNullOrEmpty(ExceptionText2))
            {
                if (!string.IsNullOrEmpty(ExceptionText))
                {
                    ETGModConsole.Log(ExceptionText);
                }
                if (!string.IsNullOrEmpty(ExceptionText2))
                {
                    ETGModConsole.Log(ExceptionText2);
                }
                return;
            }

            ExpandSharedHooks.InstallRequiredHooks();

            AssetBundle expandSharedAssets1 = ResourceManager.LoadAssetBundle(ModAssetBundleName);
            AssetBundle sharedAssets        = ResourceManager.LoadAssetBundle("shared_auto_001");
            AssetBundle sharedAssets2       = ResourceManager.LoadAssetBundle("shared_auto_002");
            AssetBundle braveResources      = ResourceManager.LoadAssetBundle("brave_resources_001");
            AssetBundle enemiesBase         = ResourceManager.LoadAssetBundle("enemies_base_001");

            ExpandAssets.InitAudio(expandSharedAssets1, ModSoundBankName);

            ExpandObjectDatabase.BuildDatabase();


            // Init Custom GameLevelDefinitions
            ExpandCustomDungeonPrefabs.InitCustomGameLevelDefinitions(braveResources);

            // Init Custom Sprite Collections
            ExpandPrefabs.InitSpriteCollections(expandSharedAssets1);
            ExpandCustomEnemyDatabase.InitSpriteCollections(expandSharedAssets1);

            // Init ItemAPI
            SetupItemAPI(expandSharedAssets1);

            try
            {
                // Init Prefab Databases
                ExpandPrefabs.InitCustomPrefabs(expandSharedAssets1, sharedAssets, sharedAssets2, braveResources, enemiesBase);
                // Init Custom Enemy Prefabs
                ExpandCustomEnemyDatabase.InitPrefabs(expandSharedAssets1);
                // Init Custom Room Prefabs
                ExpandRoomPrefabs.InitCustomRooms(expandSharedAssets1, sharedAssets, sharedAssets2, braveResources, enemiesBase);
                // Init Custom DungeonFlow(s)
                ExpandDungeonFlow.InitDungeonFlows(sharedAssets2);
                // Post Init
                // Things that need existing stuff created first have code run here
                BootlegGuns.PostInit();
                // Dungeon Prefabs
                ExpandCustomDungeonPrefabs.InitDungoenPrefabs(expandSharedAssets1, sharedAssets, sharedAssets2, braveResources);

                ExpandLists.InvalidRatFloorRainRooms = new List <string>()
                {
                    ExpandRoomPrefabs.SecretBossRoom.name,
                    ExpandRoomPrefabs.ThwompCrossingVerticalNoRain.name,
                    ExpandRoomPrefabs.SecretRewardRoom.name,
                    ExpandPrefabs.DragunBossFoyerRoom.name,
                    ExpandPrefabs.DraGunExitRoom.name,
                    ExpandPrefabs.DraGunEndTimesRoom.name,
                    ExpandPrefabs.BlacksmithShop.name,
                    "Zelda Puzzle Room 1",
                    "Zelda Puzzle Room 2",
                    "Zelda Puzzle Room 3",
                    "Special Entrance"
                };
            } catch (Exception ex) {
                ETGModConsole.Log("[ExpandTheGungeon] ERROR: Exception occured while building prefabs!", true);
                Debug.LogException(ex);
                expandSharedAssets1 = null;
                sharedAssets        = null;
                sharedAssets2       = null;
                braveResources      = null;
                enemiesBase         = null;
                return;
            }

            // Modified version of Anywhere mod
            DungeonFlowModule.Install();

            InitConsoleCommands(ConsoleCommandName);

            GameManager.Instance.StartCoroutine(WaitForFoyerLoad());

            if (ExpandSettings.EnableLanguageFix)
            {
                GameManager.Options.CurrentLanguage = StringTableManager.GungeonSupportedLanguages.ENGLISH;
                StringTableManager.CurrentLanguage  = StringTableManager.GungeonSupportedLanguages.ENGLISH;
            }

            // Null bundles when done with them to avoid game crash issues
            expandSharedAssets1 = null;
            sharedAssets        = null;
            sharedAssets2       = null;
            braveResources      = null;
            enemiesBase         = null;
        }
        public IEnumerator CorruptionRoomTime(PlayerController user)
        {
            RoomHandler currentRoom = user.CurrentRoom;
            Dungeon     dungeon     = GameManager.Instance.Dungeon;

            m_CachedScreenCapture = PortalTextureRender();
            yield return(null);

            while (m_ScreenCapInProgress)
            {
                yield return(null);
            }

            if (currentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear))
            {
                StunEnemiesForTeleport(currentRoom, 1f);
            }

            TogglePlayerInput(user, true);

            m_cachedRoomPosition = user.transform.position;

            AkSoundEngine.PostEvent("Play_EX_CorruptionRoomTransition_01", gameObject);
            ExpandShaders.Instance.GlitchScreenForDuration(1, 1.4f, 0.1f);

            GameObject TempFXObject = new GameObject("EXScreenFXTemp")
            {
            };

            TempFXObject.transform.SetParent(dungeon.gameObject.transform);
            TempFXObject.SetActive(false);
            yield return(null);

            ExpandGlitchScreenFXController fxController = TempFXObject.AddComponent <ExpandGlitchScreenFXController>();

            fxController.shaderType   = ExpandGlitchScreenFXController.ShaderType.Glitch;
            fxController.GlitchAmount = 0;
            yield return(null);

            TempFXObject.SetActive(true);
            while (fxController.GlitchAmount < 1)
            {
                fxController.GlitchAmount += (BraveTime.DeltaTime / 0.5f);
                yield return(null);
            }

            bool m_CopyCurrentRoom = false;

            if (!string.IsNullOrEmpty(currentRoom.GetRoomName()))
            {
                m_CopyCurrentRoom = (UnityEngine.Random.value < 0.05f);
            }

            PrototypeDungeonRoom SelectedPrototypeDungeonRoom = null;

            bool IsExitElevatorRoom = false;

            if (m_CopyCurrentRoom)
            {
                try {
                    SelectedPrototypeDungeonRoom = RoomBuilder.GenerateRoomPrefabFromTexture2D(RoomDebug.DumpRoomAreaToTexture2D(currentRoom));
                } catch (Exception ex) {
                    if (ExpandSettings.debugMode)
                    {
                        ETGModConsole.Log("[ExpandTheGungeon.TheLeadKey] ERROR: Exception occured while building room!", true);
                        Debug.LogException(ex);
                    }
                    AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                    TogglePlayerInput(user, false);
                    ClearCooldowns();
                    yield break;
                }
            }
            else
            {
                float RoomSelectionSeed = UnityEngine.Random.value;
                bool  GoingToSecretBoss = false;

                if (RoomSelectionSeed <= 0.01f)
                {
                    GoingToSecretBoss = true;
                }

                if (!GoingToSecretBoss | ExpandSettings.HasSpawnedSecretBoss)
                {
                    if (RoomSelectionSeed <= 0.05f && GameManager.Instance.CurrentFloor != 6 && GameManager.Instance.CurrentFloor != 5 && !ExpandSettings.phobosElevatorHasBeenUsed)
                    {
                        SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(ExitElevatorRoomList);
                        IsExitElevatorRoom           = true;
                    }
                    else if (RoomSelectionSeed <= 0.25f)
                    {
                        SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(RewardRoomList);
                    }
                    else if (RoomSelectionSeed <= 0.5f)
                    {
                        List <PrototypeDungeonRoom> m_SpecialRooms = new List <PrototypeDungeonRoom>();

                        m_SpecialRooms.Add(BraveUtility.RandomElement(NPCRoomList));
                        m_SpecialRooms.Add(BraveUtility.RandomElement(SecretRoomList));
                        m_SpecialRooms.Add(BraveUtility.RandomElement(ShrineRoomList));

                        SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(m_SpecialRooms);
                    }
                    else
                    {
                        SelectedPrototypeDungeonRoom = BraveUtility.RandomElement(MainRoomlist);
                    }
                }
                else
                {
                    ExpandSettings.HasSpawnedSecretBoss = true;

                    RoomHandler[] SecretBossRoomCluster = null;

                    try {
                        SecretBossRoomCluster = GenerateCorruptedBossRoomCluster();
                    } catch (Exception ex) {
                        ETGModConsole.Log("[ExpandTheGungeon.TheLeadKey] ERROR: Exception occured while building room!", true);
                        if (ExpandSettings.debugMode)
                        {
                            Debug.LogException(ex);
                        }
                        AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                        TogglePlayerInput(user, false);
                        ClearCooldowns();
                        yield break;
                    }
                    yield return(null);

                    if (SecretBossRoomCluster == null)
                    {
                        AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                        TogglePlayerInput(user, false);
                        ClearCooldowns();
                        yield break;
                    }

                    ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, SecretBossRoomCluster[0], null, true, true);
                    ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, SecretBossRoomCluster[1], null, true, true);

                    TeleportToRoom(user, SecretBossRoomCluster[0]);

                    while (m_IsTeleporting)
                    {
                        yield return(null);
                    }


                    GameObject m_PortalWarpObjectBossCluster = Instantiate(ExpandPrefabs.EX_GlitchPortal, (user.gameObject.transform.position + new Vector3(0.75f, 0)), Quaternion.identity);
                    ExpandGlitchPortalController m_PortalControllerBossCluster = m_PortalWarpObjectBossCluster.GetComponent <ExpandGlitchPortalController>();
                    if (m_CachedScreenCapture)
                    {
                        m_PortalControllerBossCluster.renderer.material.SetTexture("_PortalTex", m_CachedScreenCapture);
                    }
                    m_PortalControllerBossCluster.CachedPosition = m_cachedRoomPosition;
                    m_PortalControllerBossCluster.ParentRoom     = SecretBossRoomCluster[0];
                    SecretBossRoomCluster[0].RegisterInteractable(m_PortalControllerBossCluster);

                    while (fxController.GlitchAmount > 0)
                    {
                        fxController.GlitchAmount -= (BraveTime.DeltaTime / 0.5f);
                        yield return(null);
                    }

                    TogglePlayerInput(user, false);

                    m_PortalControllerBossCluster.Configured = true;

                    Destroy(TempFXObject);
                    m_InUse = false;
                    yield break;
                }
            }

            if (SelectedPrototypeDungeonRoom == null)
            {
                AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                TogglePlayerInput(user, false);
                ClearCooldowns();
                yield break;
            }

            if (m_CopyCurrentRoom)
            {
                SelectedPrototypeDungeonRoom.overrideRoomVisualType = currentRoom.RoomVisualSubtype;
            }

            RoomHandler GlitchRoom = ExpandUtility.AddCustomRuntimeRoom(SelectedPrototypeDungeonRoom, IsExitElevatorRoom, false, allowProceduralLightFixtures: (true || m_CopyCurrentRoom));

            if (GlitchRoom == null)
            {
                AkSoundEngine.PostEvent("Play_OBJ_purchase_unable_01", gameObject);
                TogglePlayerInput(user, false);
                ClearCooldowns();
                yield break;
            }

            if (!string.IsNullOrEmpty(GlitchRoom.GetRoomName()))
            {
                GlitchRoom.area.PrototypeRoomName = ("Corrupted " + GlitchRoom.GetRoomName());
            }
            else
            {
                GlitchRoom.area.PrototypeRoomName = ("Corrupted Room");
            }

            if (m_CopyCurrentRoom)
            {
                if (ExpandSettings.EnableGlitchFloorScreenShader && !dungeon.IsGlitchDungeon)
                {
                    GameObject GlitchShaderObject = Instantiate(ExpandPrefabs.EXGlitchFloorScreenFX, GlitchRoom.area.UnitCenter, Quaternion.identity);
                    ExpandGlitchScreenFXController FXController = GlitchShaderObject.GetComponent <ExpandGlitchScreenFXController>();
                    FXController.isRoomSpecific        = true;
                    FXController.ParentRoom            = GlitchRoom;
                    FXController.UseCorruptionAmbience = m_CopyCurrentRoom;
                    GlitchShaderObject.transform.SetParent(dungeon.gameObject.transform);
                }

                GameObject[] Objects = FindObjectsOfType <GameObject>();

                try {
                    foreach (GameObject Object in Objects)
                    {
                        if (Object && Object.transform.parent == currentRoom.hierarchyParent && IsValidObject(Object))
                        {
                            Vector3    OrigPosition = (Object.transform.position - currentRoom.area.basePosition.ToVector3());
                            Vector3    NewPosition  = (OrigPosition + GlitchRoom.area.basePosition.ToVector3());
                            GameObject newObject    = Instantiate(Object, NewPosition, Quaternion.identity);
                            newObject.transform.SetParent(GlitchRoom.hierarchyParent);

                            if (newObject.GetComponent <BaseShopController>())
                            {
                                Destroy(newObject.GetComponent <BaseShopController>());
                            }
                            if (newObject.GetComponent <PathingTrapController>())
                            {
                                Destroy(newObject.GetComponent <PathingTrapController>());
                            }

                            if (newObject.GetComponent <IPlaceConfigurable>() != null)
                            {
                                newObject.GetComponent <IPlaceConfigurable>().ConfigureOnPlacement(GlitchRoom);
                            }

                            if (newObject.GetComponent <TalkDoerLite>())
                            {
                                newObject.GetComponent <TalkDoerLite>().SpeaksGleepGlorpenese = true;
                            }

                            if (newObject.GetComponent <IPlayerInteractable>() != null)
                            {
                                GlitchRoom.RegisterInteractable(newObject.GetComponent <IPlayerInteractable>());
                            }

                            if (newObject.GetComponent <FlippableCover>())
                            {
                                ExpandKickableObject kickableObject = newObject.AddComponent <ExpandKickableObject>();
                                newObject.GetComponent <ExpandKickableObject>().ConfigureOnPlacement(GlitchRoom);
                                GlitchRoom.RegisterInteractable(kickableObject);
                            }

                            if (newObject && UnityEngine.Random.value <= 0.4f && !newObject.GetComponent <AIActor>() && !newObject.GetComponent <Chest>())
                            {
                                if (!string.IsNullOrEmpty(newObject.name) && !newObject.name.ToLower().StartsWith("glitchtile") && !newObject.name.ToLower().StartsWith("ex secret door") && !newObject.name.ToLower().StartsWith("lock") && !newObject.name.ToLower().StartsWith("chest"))
                                {
                                    float RandomIntervalFloat       = UnityEngine.Random.Range(0.02f, 0.04f);
                                    float RandomDispFloat           = UnityEngine.Random.Range(0.06f, 0.08f);
                                    float RandomDispIntensityFloat  = UnityEngine.Random.Range(0.07f, 0.1f);
                                    float RandomColorProbFloat      = UnityEngine.Random.Range(0.035f, 0.1f);
                                    float RandomColorIntensityFloat = UnityEngine.Random.Range(0.05f, 0.1f);
                                    ExpandShaders.Instance.BecomeGlitched(newObject, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat);
                                }
                            }
                        }
                    }
                } catch (Exception ex) {
                    if (ExpandSettings.debugMode)
                    {
                        ETGModConsole.Log("[ExpandTheGungeon.TheLeadKey] ERROR: Exception occured while duplicating objects for new room!", true);
                        Debug.LogException(ex);
                    }
                }

                IntVector2 ChestPosition = ExpandObjectDatabase.GetRandomAvailableCellForChest(dungeon, GlitchRoom, new List <IntVector2>());

                if (ChestPosition != IntVector2.Zero)
                {
                    GameObject      newChest  = Instantiate(ExpandPrefabs.SurpriseChestObject, ChestPosition.ToVector3(), Quaternion.identity);
                    ExpandFakeChest fakeChest = newChest.GetComponent <ExpandFakeChest>();
                    fakeChest.ConfigureOnPlacement(GlitchRoom);
                    GlitchRoom.RegisterInteractable(fakeChest);
                }
            }

            if (GlitchRoom.area.PrototypeRoomCategory == PrototypeDungeonRoom.RoomCategory.SECRET && GlitchRoom.IsSecretRoom)
            {
                GlitchRoom.secretRoomManager.OpenDoor();
            }

            if (m_CopyCurrentRoom)
            {
                ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, GlitchRoom, null, false, true, true);
            }
            else
            {
                ExpandPlaceCorruptTiles.PlaceCorruptTiles(dungeon, GlitchRoom, null, true, true, true);
            }

            if (IsExitElevatorRoom)
            {
                ElevatorDepartureController DepartureElevator = null;

                if (FindObjectsOfType <ElevatorDepartureController>() != null)
                {
                    foreach (ElevatorDepartureController elevator in FindObjectsOfType <ElevatorDepartureController>())
                    {
                        if (elevator.gameObject.transform.parent == GlitchRoom.hierarchyParent)
                        {
                            DepartureElevator = elevator;
                            break;
                        }
                    }
                }

                if (DepartureElevator)
                {
                    ExpandElevatorDepartureManager exElevator = DepartureElevator.gameObject.AddComponent <ExpandElevatorDepartureManager>();
                    exElevator.OverrideTargetFloor = GlobalDungeonData.ValidTilesets.PHOBOSGEON;
                }
                TeleportToRoom(user, GlitchRoom, false, m_CopyCurrentRoom, new Vector2(4, 2));
            }
            else
            {
                TeleportToRoom(user, GlitchRoom, false, m_CopyCurrentRoom);
            }
            yield return(null);

            while (m_IsTeleporting)
            {
                yield return(null);
            }

            if (user.transform.position.GetAbsoluteRoom() != null)
            {
                if (user.CurrentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear))
                {
                    user.CurrentRoom.CompletelyPreventLeaving = true;
                }
            }
            if (GameManager.Instance.CurrentFloor == 1)
            {
                if (dungeon.data.Entrance != null)
                {
                    dungeon.data.Entrance.AddProceduralTeleporterToRoom();
                }
            }

            GameObject m_PortalWarpObject = Instantiate(ExpandPrefabs.EX_GlitchPortal, (user.gameObject.transform.position + new Vector3(0.75f, 0)), Quaternion.identity);
            ExpandGlitchPortalController m_PortalController = m_PortalWarpObject.GetComponent <ExpandGlitchPortalController>();

            if (m_CachedScreenCapture)
            {
                m_PortalController.renderer.material.SetTexture("_PortalTex", m_CachedScreenCapture);
            }
            m_PortalController.CachedPosition = m_cachedRoomPosition;
            m_PortalController.ParentRoom     = GlitchRoom;
            GlitchRoom.RegisterInteractable(m_PortalController);

            while (fxController.GlitchAmount > 0)
            {
                fxController.GlitchAmount -= (BraveTime.DeltaTime / 0.5f);
                yield return(null);
            }

            TogglePlayerInput(user, false);

            m_PortalController.Configured = true;

            Destroy(TempFXObject);

            m_InUse = false;
            yield break;
        }
        public ExpandSpawnGlitchObjectOnDeath()
        {
            deathType                      = DeathType.Death;
            preDeathDelay                  = 0f;
            chanceToSpawn                  = 1f;
            triggerName                    = "";
            extraPixelWidth                = 7;
            minSpawnCount                  = 1;
            maxSpawnCount                  = 1;
            allowSpawnOverPit              = true;
            spawnRatCorpse                 = false;
            spawnRatKey                    = false;
            ratCorpseSpawnsKey             = false;
            parentEnemyWasRat              = false;
            ratCorpseSpawnsItemOnExplosion = false;
            usesExternalObjectArray        = false;
            objectSelection                = ObjectSelection.Random;
            ExpandObjectDatabase objectDatabase = new ExpandObjectDatabase();

            objectsToSpawn = new GameObject[] {
                ExpandPrefabs.MimicNPC,
                ExpandPrefabs.RatCorpseNPC,
                ExpandPrefabs.MouseTrap1,
                ExpandPrefabs.MouseTrap2,
                ExpandPrefabs.MouseTrap3,
                ExpandPrefabs.PlayerLostRatNote,
                ExpandPrefabs.NPCBabyDragunChaos,
                objectDatabase.NPCTruthKnower,
                objectDatabase.ChestTruth,
                objectDatabase.ConvictPastDancers[UnityEngine.Random.Range(0, 15)],
                objectDatabase.HangingPot,
                objectDatabase.RatTrapDoorIcon,
                objectDatabase.RedDrum,
                objectDatabase.IceBomb,
                objectDatabase.YellowDrum,
                objectDatabase.WaterDrum,
                objectDatabase.TableHorizontal,
                objectDatabase.TableVertical,
                objectDatabase.TableHorizontalStone,
                objectDatabase.TableVerticalStone,
                objectDatabase.NPCOldMan,
                objectDatabase.NPCSynergrace,
                objectDatabase.NPCGunMuncher,
                objectDatabase.NPCMonsterManuel,
                objectDatabase.NPCTruthKnower,
                objectDatabase.NPCGuardLeft,
                objectDatabase.NPCGuardRight,
                objectDatabase.AmygdalaNorth,
                objectDatabase.AmygdalaSouth,
                objectDatabase.AmygdalaWest,
                objectDatabase.AmygdalaEast,
                objectDatabase.SpaceFog,
                objectDatabase.LockedDoor,
                objectDatabase.SpikeTrap,
                objectDatabase.FlameTrap,
                objectDatabase.CultistBaldBowBackLeft,
                objectDatabase.CultistBaldBowBackRight,
                objectDatabase.CultistBaldBowBack,
                objectDatabase.CultistBaldBowLeft,
                objectDatabase.CultistHoodBowBack,
                objectDatabase.CultistHoodBowLeft,
                objectDatabase.CultistHoodBowRight
            };
            // objectDatabase = null;
            Destroy(objectDatabase);
        }
        private void Start()
        {
            sprite.HeightOffGround = -7;
            sprite.UpdateZDepth();

            ExpandObjectDatabase objectDatabase = new ExpandObjectDatabase();

            Vector3 NoteSpawnPoint = (new Vector3(7, 3) + m_ParentRoom.area.basePosition.ToVector3());

            GameObject DeadGuyNote = Instantiate(ExpandPrefabs.PlayerLostRatNote, NoteSpawnPoint, Quaternion.identity);

            NoteDoer DeadGuyNoteComponent = DeadGuyNote.GetComponent <NoteDoer>();

            if (DeadGuyNoteComponent != null)
            {
                DeadGuyNoteComponent.stringKey            = "We shipwrecked chasing a terrible monster.\n\nManaged to lure and trap it in this weird dungeon full of living bullets...\n\nAlas, I could not slay the beast but managed to trap it in this chamber. I used a teleporter prototype to teleport the key to this chamber far away.\n\nI don't know where it ended up, but I hope no one finds it.";
                DeadGuyNoteComponent.useAdditionalStrings = false;
                DeadGuyNoteComponent.alreadyLocalized     = true;
                DeadGuyNoteComponent.name = "Dead Man's Note";
                m_ParentRoom.RegisterInteractable(DeadGuyNoteComponent);
            }

            Gun m_CachedMutantArmGun = (PickupObjectDatabase.GetById(333) as Gun);


            GameObject m_GoopInstance1 = new GameObject("Bloodstain 1", typeof(tk2dSprite))
            {
                layer = 0
            };
            GameObject m_GoopInstance2 = new GameObject("Bloodstain 2", typeof(tk2dSprite))
            {
                layer = 0
            };
            GameObject m_GoopInstance3 = new GameObject("Bloodstain 3", typeof(tk2dSprite))
            {
                layer = 0
            };
            GameObject m_GoopInstance4 = new GameObject("Bloodstain 4", typeof(tk2dSprite))
            {
                layer = 0
            };
            GameObject m_GoopInstance5 = new GameObject("Bloodstain 5", typeof(tk2dSprite))
            {
                layer = 0
            };
            GameObject m_GoopInstance6 = new GameObject("Bloodstain 6", typeof(tk2dSprite))
            {
                layer = 0
            };

            m_GoopInstance1.transform.position = (m_ParentRoom.area.basePosition.ToVector3() + new Vector3(13, 2));
            m_GoopInstance2.transform.position = (m_ParentRoom.area.basePosition.ToVector3() + new Vector3(33, 5));
            m_GoopInstance3.transform.position = (m_ParentRoom.area.basePosition.ToVector3() + new Vector3(40, 2));
            m_GoopInstance4.transform.position = (m_ParentRoom.area.basePosition.ToVector3() + new Vector3(48, 3));
            m_GoopInstance5.transform.position = (m_ParentRoom.area.basePosition.ToVector3() + new Vector3(57, 5));
            m_GoopInstance6.transform.position = (m_ParentRoom.area.basePosition.ToVector3() + new Vector3(58, 2));
            m_GoopInstance1.transform.parent   = m_ParentRoom.hierarchyParent;
            m_GoopInstance2.transform.parent   = m_ParentRoom.hierarchyParent;
            m_GoopInstance3.transform.parent   = m_ParentRoom.hierarchyParent;
            m_GoopInstance4.transform.parent   = m_ParentRoom.hierarchyParent;
            m_GoopInstance5.transform.parent   = m_ParentRoom.hierarchyParent;
            m_GoopInstance6.transform.parent   = m_ParentRoom.hierarchyParent;


            GoopDoer[] m_BloodGoopDoers = new GoopDoer[] {
                m_GoopInstance1.AddComponent <GoopDoer>(),
                m_GoopInstance2.AddComponent <GoopDoer>(),
                m_GoopInstance3.AddComponent <GoopDoer>(),
                m_GoopInstance4.AddComponent <GoopDoer>(),
                m_GoopInstance5.AddComponent <GoopDoer>(),
                m_GoopInstance6.AddComponent <GoopDoer>()
            };

            tk2dSprite[] m_DummySprites = new tk2dSprite[] {
                m_GoopInstance1.GetComponent <tk2dSprite>(),
                m_GoopInstance2.GetComponent <tk2dSprite>(),
                m_GoopInstance3.GetComponent <tk2dSprite>(),
                m_GoopInstance4.GetComponent <tk2dSprite>(),
                m_GoopInstance5.GetComponent <tk2dSprite>(),
                m_GoopInstance6.GetComponent <tk2dSprite>(),
            };

            foreach (tk2dSprite sprite in m_DummySprites)
            {
                sprite.Collection = m_CachedMutantArmGun.sprite.Collection;
                sprite.SetSprite(0);
                sprite.renderer.enabled = false;
            }


            foreach (GoopDoer goop in m_BloodGoopDoers)
            {
                goop.goopDefinition         = m_CachedMutantArmGun.singleModule.projectiles[0].gameObject.GetComponent <GoopModifier>().goopDefinition;
                goop.positionSource         = GoopDoer.PositionSource.SpriteCenter;
                goop.updateTiming           = GoopDoer.UpdateTiming.Always;
                goop.updateFrequency        = 0.05f;
                goop.isTimed                = false;
                goop.goopTime               = 1;
                goop.updateOnPreDeath       = true;
                goop.updateOnDeath          = false;
                goop.updateOnAnimFrames     = true;
                goop.updateOnCollision      = false;
                goop.updateOnGrounded       = false;
                goop.updateOnDestroy        = false;
                goop.defaultGoopRadius      = 1;
                goop.suppressSplashes       = false;
                goop.goopSizeVaries         = true;
                goop.varyCycleTime          = 0.9f;
                goop.radiusMin              = UnityEngine.Random.Range(0.8f, 1);
                goop.radiusMax              = UnityEngine.Random.Range(1.25f, 1.6f);
                goop.goopSizeRandom         = true;
                goop.UsesDispersalParticles = false;
                goop.DispersalDensity       = 3;
                goop.DispersalMinCoherency  = 0.2f;
                goop.DispersalMaxCoherency  = 1;
            }
        }
示例#9
0
        private void PlaceRandomCacti(Dungeon dungeon, RoomHandler currentRoom, ExpandObjectDatabase objectDatabase, int RandomObjectsPlaced, int RandomObjectsSkipped)
        {
            PrototypeDungeonRoom.RoomCategory roomCategory = currentRoom.area.PrototypeRoomCategory;

            if (currentRoom == null | roomCategory == PrototypeDungeonRoom.RoomCategory.REWARD | currentRoom.IsMaintenanceRoom() |
                string.IsNullOrEmpty(currentRoom.GetRoomName()) | currentRoom.GetRoomName().StartsWith("Boss Foyer") |
                currentRoom.RoomVisualSubtype != 0 | !currentRoom.HasActiveEnemies(RoomHandler.ActiveEnemyType.RoomClear))
            {
                return;
            }

            if (Random.value <= 0.8f)
            {
                List <IntVector2> m_CachedPositions = new List <IntVector2>();
                int MaxCactiCount = 12;
                int MinCactiCount = 6;
                if (Random.value <= 0.3f)
                {
                    MaxCactiCount = 20;
                }
                else if (roomCategory == PrototypeDungeonRoom.RoomCategory.BOSS)
                {
                    MaxCactiCount = 10;
                }

                int X = currentRoom.area.dimensions.x;
                int Y = currentRoom.area.dimensions.y;

                if (X * Y < 100)
                {
                    MinCactiCount = 3;
                    MaxCactiCount = 6;
                }

                int CactusCount = Random.Range(MinCactiCount, MaxCactiCount);

                for (int i = 0; i < CactusCount; i++)
                {
                    IntVector2?RandomVector = GetRandomAvailableCell(dungeon, currentRoom, m_CachedPositions, ExitClearence: 3, avoidExits: true);

                    List <GameObject> CactiList = new List <GameObject>()
                    {
                        ExpandPrefabs.Cactus_A, ExpandPrefabs.Cactus_B
                    };
                    CactiList = CactiList.Shuffle();

                    if (RandomVector.HasValue)
                    {
                        GameObject Cactus = Instantiate(BraveUtility.RandomElement(CactiList), RandomVector.Value.ToVector3(), Quaternion.identity);
                        Cactus.transform.parent = currentRoom.hierarchyParent;
                        RandomObjectsPlaced++;
                        if (m_CachedPositions.Count <= 0)
                        {
                            break;
                        }
                    }
                    else
                    {
                        RandomObjectsSkipped++;
                    }
                }
            }
        }
示例#10
0
        public void PlaceFloorDecoration(Dungeon dungeon, List <RoomHandler> roomListOverride = null, bool ignoreTilesetType = false)
        {
            List <GlobalDungeonData.ValidTilesets> ValidTilesets = new List <GlobalDungeonData.ValidTilesets>()
            {
                GlobalDungeonData.ValidTilesets.BELLYGEON,
                GlobalDungeonData.ValidTilesets.WESTGEON,
                GlobalDungeonData.ValidTilesets.MINEGEON
            };

            if (!ignoreTilesetType && !ValidTilesets.Contains(dungeon.tileIndices.tilesetId))
            {
                return;
            }

            int RandomObjectsPlaced  = 0;
            int RandomObjectsSkipped = 0;

            ExpandObjectDatabase objectDatabase = new ExpandObjectDatabase();

            if ((dungeon.data.rooms == null | dungeon.data.rooms.Count <= 0) && roomListOverride == null)
            {
                return;
            }

            List <RoomHandler> DungeonRooms = dungeon.data.rooms;

            if (roomListOverride != null)
            {
                DungeonRooms = roomListOverride;
            }

            foreach (RoomHandler currentRoom in DungeonRooms)
            {
                try {
                    if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.WESTGEON)
                    {
                        PlaceRandomCacti(dungeon, currentRoom, objectDatabase, RandomObjectsPlaced, RandomObjectsSkipped);
                    }
                    else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.BELLYGEON)
                    {
                        PlaceRandomCorpses(dungeon, currentRoom, objectDatabase, RandomObjectsPlaced, RandomObjectsSkipped);
                    }
                    else if (dungeon.tileIndices.tilesetId == GlobalDungeonData.ValidTilesets.MINEGEON)
                    {
                        PlaceRandomAlarmMushrooms(dungeon, currentRoom, RandomObjectsPlaced, RandomObjectsSkipped);
                    }
                } catch (System.Exception ex) {
                    if (ExpandStats.debugMode)
                    {
                        ETGModConsole.Log("[DEBUG] Exception while setting up or objects for current room", false);
                    }
                    if (ExpandStats.debugMode)
                    {
                        ETGModConsole.Log("[DEBUG] Skipping current room...", false);
                    }
                    if (ExpandStats.debugMode)
                    {
                        ETGModConsole.Log(ex.Message + ex.StackTrace + ex.Source, false);
                    }
                }
            }
            if (ExpandStats.debugMode)
            {
                // ETGModConsole.Log("[DEBUG] Max Number of floor decoration objects assignable per room: " + MaxObjectsPerRoom, false);
                ETGModConsole.Log("[DEBUG] Number of floor decoration objects placed: " + RandomObjectsPlaced, false);
                ETGModConsole.Log("[DEBUG] Number of floor decoration objects skipped: " + RandomObjectsSkipped, false);
                if (RandomObjectsPlaced <= 0)
                {
                    ETGModConsole.Log("[DEBUG] Warning: No corpse objects have been placed!", false);
                }
            }
            objectDatabase = null;
            return;
        }