private void LateUpdate() { if (RevealPercentage < 1f) { UpdateGoopedCells(); UpdatePlayerPositions(); if (!m_revealing) { float num = CalcAvgRevealedness(); if (num > 0.33f) { StartCoroutine(GraduallyReveal()); } } if (m_blendTexDirty) { m_blendTex.SetPixels(m_blendTexColors); m_blendTex.Apply(); } } else if (Lock.Suppress) { 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.4f); float RandomColorProbFloat = UnityEngine.Random.Range(0.05f, 0.2f); float RandomColorIntensityFloat = UnityEngine.Random.Range(0.1f, 0.25f); Lock.Suppress = false; // Lock2.Suppress = false; ChaosShaders.Instance.ApplyGlitchShader(null, Lock.GetComponentInChildren <tk2dBaseSprite>(), true, RandomIntervalFloat, RandomDispFloat, RandomDispIntensityFloat, RandomColorProbFloat, RandomColorIntensityFloat); Minimap.Instance.RegisterRoomIcon(transform.position.GetAbsoluteRoom(), MinimapIcon, false); } else if (!Lock.IsLocked) { Open(); } }
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; }