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>()); }
public static void AddObjectToRoom(PrototypeDungeonRoom room, Vector2 position, GameObject PlacableObject, int xOffset = 0, int yOffset = 0, int layer = 0, float SpawnChance = 1f) { if (room == null) { return; } if (room.placedObjects == null) { room.placedObjects = new List <PrototypePlacedObjectData>(); } if (room.placedObjectPositions == null) { room.placedObjectPositions = new List <Vector2>(); } PrototypePlacedObjectData m_NewObjectData = new PrototypePlacedObjectData() { placeableContents = ExpandUtility.GenerateDungeonPlacable(PlacableObject, useExternalPrefab: true), nonenemyBehaviour = null, spawnChance = SpawnChance, unspecifiedContents = null, enemyBehaviourGuid = string.Empty, contentsBasePosition = position, layer = layer, xMPxOffset = xOffset, yMPxOffset = yOffset, fieldData = new List <PrototypePlacedObjectFieldData>(0), instancePrerequisites = new DungeonPrerequisite[0], linkedTriggerAreaIDs = new List <int>(0), assignedPathIDx = -1, assignedPathStartNode = 0 }; room.placedObjects.Add(m_NewObjectData); room.placedObjectPositions.Add(position); return; }
private void SelfDestructOnKick() { int currentCurse = PlayerStats.GetTotalCurse(); int currentCoolness = PlayerStats.GetTotalCoolness(); float ExplodeOnKickChances = 0.25f; float ExplodeOnKickDamageToEnemies = 150f; Vector2 ExplosionCenterPosition = sprite.WorldCenter; bool ExplodeOnKickDamagesPlayer = BraveUtility.RandomBool(); if (willDefinitelyExplode) { ExplodeOnKickDamagesPlayer = false; ExplodeOnKickDamageToEnemies = 200f; } else { if (currentCoolness >= 3) { ExplodeOnKickDamagesPlayer = false; ExplodeOnKickDamageToEnemies = 175f; } if (currentCurse >= 3) { ExplodeOnKickChances = 0.35f; ExplodeOnKickDamageToEnemies = 200f; } } if (!ExplodeOnKickDamagesPlayer) { TableExplosionData.damageToPlayer = 0; } if (spawnObjectOnSelfDestruct && SpawnedObject != null && !m_objectSpawned) { m_objectSpawned = true; GameObject PlacedGlitchObject = ExpandUtility.GenerateDungeonPlacable(SpawnedObject, false, true).InstantiateObject(transform.position.GetAbsoluteRoom(), (specRigidbody.GetUnitCenter(ColliderType.HitBox) - transform.position.GetAbsoluteRoom().area.basePosition.ToVector2()).ToIntVector2(VectorConversions.Floor)); PlacedGlitchObject.transform.parent = transform.position.GetAbsoluteRoom().hierarchyParent; if (PlacedGlitchObject.GetComponent <PickupObject>() != null) { PickupObject PlacedGltichObjectComponent = PlacedGlitchObject.GetComponent <PickupObject>(); PlacedGltichObjectComponent.RespawnsIfPitfall = true; } } if (UnityEngine.Random.value <= ExplodeOnKickChances | willDefinitelyExplode) { if (useDefaultExplosion) { Exploder.DoDefaultExplosion(ExplosionCenterPosition, Vector2.zero, null, true, CoreDamageTypes.None); Exploder.DoRadialDamage(ExplodeOnKickDamageToEnemies, ExplosionCenterPosition, 4f, ExplodeOnKickDamagesPlayer, true, true); } else { Exploder.Explode(ExplosionCenterPosition, TableExplosionData, Vector2.zero, null, false, CoreDamageTypes.None, false); } Destroy(gameObject); return; } return; }
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; }
private IEnumerator SpwanEnemyAirDrop(float delay = 0.4f) { Vector3 RoomOffset = m_room.area.basePosition.ToVector3(); string EnemyGUID1 = "88b6b6a93d4b4234a67844ef4728382c"; // bandana_bullet_kin string EnemyGUID2 = "4d37ce3d666b4ddda8039929225b7ede"; // grenade_kin string EnemyGUID3 = "01972dee89fc4404a5c408d50007dad5"; // bullet_kin string EnemyGUID4 = "128db2f0781141bcb505d8f00f9e4d47"; // red_shotgun_kin if (UnityEngine.Random.value <= 0.5f) { EnemyGUID1 = ExpandCustomEnemyDatabase.BootlegBulletManBandanaGUID; } if (UnityEngine.Random.value <= 0.1f) { EnemyGUID2 = ExpandCustomEnemyDatabase.BootlegShotgunManBlueGUID; } if (UnityEngine.Random.value <= 0.5f) { EnemyGUID3 = ExpandCustomEnemyDatabase.BootlegBulletManGUID; } if (UnityEngine.Random.value <= 0.5f) { EnemyGUID4 = ExpandCustomEnemyDatabase.BootlegShotgunManRedGUID; } yield return(new WaitForSeconds(delay)); GameObject eCrateInstance1 = ExpandUtility.SpawnAirDrop(m_room, (RoomOffset + new Vector3(4, 3, 0)), null, ExpandUtility.GenerateDungeonPlacable(null, true, EnemyGUID: EnemyGUID1)); GameObject eCrateInstance2 = ExpandUtility.SpawnAirDrop(m_room, (RoomOffset + new Vector3(4, 9, 0)), null, ExpandUtility.GenerateDungeonPlacable(null, true, EnemyGUID: EnemyGUID2), 0.2f); GameObject eCrateInstance3 = ExpandUtility.SpawnAirDrop(m_room, (RoomOffset + new Vector3(13, 3, 0)), null, ExpandUtility.GenerateDungeonPlacable(null, true, EnemyGUID: EnemyGUID3)); GameObject eCrateInstance4 = ExpandUtility.SpawnAirDrop(m_room, (RoomOffset + new Vector3(13, 9, 0)), null, ExpandUtility.GenerateDungeonPlacable(null, true, EnemyGUID: EnemyGUID4), 0.2f); /*List<GameObject> eCrateList = new List<GameObject>(); * * if (eCrateInstance1) { eCrateList.Add(eCrateInstance1); } * if (eCrateInstance2) { eCrateList.Add(eCrateInstance1); } * if (eCrateInstance3) { eCrateList.Add(eCrateInstance1); } * if (eCrateInstance4) { eCrateList.Add(eCrateInstance1); } * * GameObject SelectedCrate = null; * * if (eCrateList.Count > 0) { SelectedCrate = BraveUtility.RandomElement(eCrateList); } * * if (SelectedCrate && SelectedCrate.GetComponent<EmergencyCrateController>()) { * yield return new WaitForSeconds(2.25f); * while (ReflectionHelpers.ReflectGetField<bool?>(typeof(EmergencyCrateController), "m_hasBeenTriggered", SelectedCrate.GetComponent<EmergencyCrateController>()).HasValue && ReflectionHelpers.ReflectGetField<bool?>(typeof(EmergencyCrateController), "m_hasBeenTriggered", SelectedCrate.GetComponent<EmergencyCrateController>()).Value) { * if (!SelectedCrate | !SelectedCrate.GetComponent<EmergencyCrateController>()) { break; } * yield return null; * } * yield return new WaitForSeconds(1f); * m_room.npcSealState = RoomHandler.NPCSealState.SealNone; * }*/ yield break; }