private DungeonPlaceable CustomItemPlacable(int ItemID = 70) { DungeonPlaceableVariant ItemVariant = new DungeonPlaceableVariant(); ItemVariant.percentChance = 1f; ItemVariant.unitOffset = Vector2.zero; ItemVariant.enemyPlaceableGuid = string.Empty; ItemVariant.pickupObjectPlaceableId = ItemID; ItemVariant.forceBlackPhantom = false; ItemVariant.addDebrisObject = false; ItemVariant.prerequisites = null; ItemVariant.materialRequirements = null; List <DungeonPlaceableVariant> ItemTiers = new List <DungeonPlaceableVariant>(); ItemTiers.Add(ItemVariant); DungeonPlaceable m_cachedPlacable = ScriptableObject.CreateInstance <DungeonPlaceable>(); m_cachedPlacable.name = "CustomItemPlacable"; m_cachedPlacable.width = 1; m_cachedPlacable.height = 1; m_cachedPlacable.roomSequential = false; m_cachedPlacable.respectsEncounterableDifferentiator = false; m_cachedPlacable.UsePrefabTransformOffset = false; m_cachedPlacable.MarkSpawnedItemsAsRatIgnored = false; m_cachedPlacable.DebugThisPlaceable = false; m_cachedPlacable.variantTiers = ItemTiers; return(m_cachedPlacable); }
// Token: 0x0600000C RID: 12 RVA: 0x00003260 File Offset: 0x00001460 public static void LogProtoRoomData(PrototypeDungeonRoom room) { int num = 0; Tools.LogPropertiesAndFields <PrototypeDungeonRoom>(room, "ROOM"); foreach (PrototypePlacedObjectData prototypePlacedObjectData in room.placedObjects) { Tools.Log <string>(string.Format("\n----------------Object #{0}----------------", num++)); Tools.LogPropertiesAndFields <PrototypePlacedObjectData>(prototypePlacedObjectData, "PLACED OBJECT"); Tools.LogPropertiesAndFields <DungeonPlaceable>((prototypePlacedObjectData != null) ? prototypePlacedObjectData.placeableContents : null, "PLACEABLE CONTENT"); bool flag = prototypePlacedObjectData == null; DungeonPlaceableVariant obj; if (flag) { obj = null; } else { DungeonPlaceable placeableContents = prototypePlacedObjectData.placeableContents; obj = ((placeableContents != null) ? placeableContents.variantTiers[0] : null); } Tools.LogPropertiesAndFields <DungeonPlaceableVariant>(obj, "VARIANT TIERS"); } Tools.Print <string>("==LAYERS==", "FFFFFF", false); foreach (PrototypeRoomObjectLayer prototypeRoomObjectLayer in room.additionalObjectLayers) { } }
private DungeonPlaceable m_CustomEnemyPlacable(string EnemyGUID = "b5e699a0abb94666bda567ab23bd91c4", bool forceBlackPhantom = false) { DungeonPlaceableVariant EnemyVariant = new DungeonPlaceableVariant(); EnemyVariant.percentChance = 1f; EnemyVariant.unitOffset = Vector2.zero; EnemyVariant.enemyPlaceableGuid = EnemyGUID; EnemyVariant.pickupObjectPlaceableId = -1; EnemyVariant.forceBlackPhantom = forceBlackPhantom; EnemyVariant.addDebrisObject = false; EnemyVariant.prerequisites = null; EnemyVariant.materialRequirements = null; List <DungeonPlaceableVariant> EnemyTiers = new List <DungeonPlaceableVariant>(); EnemyTiers.Add(EnemyVariant); DungeonPlaceable m_cachedPlacable = ScriptableObject.CreateInstance <DungeonPlaceable>(); m_cachedPlacable.name = "CustomEnemyPlacable"; m_cachedPlacable.width = 1; m_cachedPlacable.height = 1; m_cachedPlacable.roomSequential = false; m_cachedPlacable.respectsEncounterableDifferentiator = false; m_cachedPlacable.UsePrefabTransformOffset = false; m_cachedPlacable.MarkSpawnedItemsAsRatIgnored = false; m_cachedPlacable.DebugThisPlaceable = false; m_cachedPlacable.variantTiers = EnemyTiers; return(m_cachedPlacable); }
public static void AddPlaceableToRoom(PrototypeDungeonRoom room, Vector2 location, string assetPath) { try { GameObject asset = GetGameObjectFromBundles(assetPath); if (asset) { DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0]; room.placedObjectPositions.Add(location); var placeableContents = ScriptableObject.CreateInstance <DungeonPlaceable>(); placeableContents.width = 2; placeableContents.height = 2; placeableContents.respectsEncounterableDifferentiator = true; placeableContents.variantTiers = new List <DungeonPlaceableVariant>() { new DungeonPlaceableVariant() { percentChance = 1, nonDatabasePlaceable = asset, prerequisites = emptyReqs, materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0] } }; room.placedObjects.Add(new PrototypePlacedObjectData() { contentsBasePosition = location, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = emptyReqs, linkedTriggerAreaIDs = new List <int>(), placeableContents = placeableContents }); //Tools.Print($"Added {asset.name} to room."); return; } DungeonPlaceable placeable = GetPlaceableFromBundles(assetPath); if (placeable) { DungeonPrerequisite[] emptyReqs = new DungeonPrerequisite[0]; room.placedObjectPositions.Add(location); room.placedObjects.Add(new PrototypePlacedObjectData() { contentsBasePosition = location, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = emptyReqs, linkedTriggerAreaIDs = new List <int>(), placeableContents = placeable }); return; } Tools.PrintError($"Unable to find asset in asset bundles: {assetPath}"); } catch (Exception e) { Tools.PrintException(e); } }
public static void AddPlaceableToRoom(PrototypeDungeonRoom room, Vector2 location, string assetPath) { try { if (GetGameObjectFromBundles(assetPath) != null) { DungeonPrerequisite[] array = new DungeonPrerequisite[0]; room.placedObjectPositions.Add(location); DungeonPlaceable dungeonPlaceable = ScriptableObject.CreateInstance <DungeonPlaceable>(); dungeonPlaceable.width = 2; dungeonPlaceable.height = 2; dungeonPlaceable.respectsEncounterableDifferentiator = true; dungeonPlaceable.variantTiers = new List <DungeonPlaceableVariant> { new DungeonPlaceableVariant { percentChance = 1f, nonDatabasePlaceable = GetGameObjectFromBundles(assetPath), prerequisites = array, materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0] } }; room.placedObjects.Add(new PrototypePlacedObjectData { contentsBasePosition = location, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = array, linkedTriggerAreaIDs = new List <int>(), placeableContents = dungeonPlaceable }); return; } else if (GetPlaceableFromBundles(assetPath) != null) { DungeonPrerequisite[] instancePrerequisites = new DungeonPrerequisite[0]; room.placedObjectPositions.Add(location); room.placedObjects.Add(new PrototypePlacedObjectData { contentsBasePosition = location, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = instancePrerequisites, linkedTriggerAreaIDs = new List <int>(), placeableContents = GetPlaceableFromBundles(assetPath) }); return; } else { Tools.PrintError("Unable to find asset in asset bundles: " + assetPath, "FF0000"); } } catch (Exception e) { Tools.PrintException(e); } }
// Token: 0x0600004C RID: 76 RVA: 0x00004EDC File Offset: 0x000030DC public static void AddEnemyToRoom(PrototypeDungeonRoom room, Vector2 location, string guid, int layer) { DungeonPrerequisite[] array = new DungeonPrerequisite[0]; DungeonPlaceable dungeonPlaceable = ScriptableObject.CreateInstance <DungeonPlaceable>(); dungeonPlaceable.width = 1; dungeonPlaceable.height = 1; dungeonPlaceable.respectsEncounterableDifferentiator = true; dungeonPlaceable.variantTiers = new List <DungeonPlaceableVariant> { new DungeonPlaceableVariant { percentChance = 1f, prerequisites = array, enemyPlaceableGuid = guid, materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0] } }; PrototypePlacedObjectData prototypePlacedObjectData = new PrototypePlacedObjectData { contentsBasePosition = location, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = array, linkedTriggerAreaIDs = new List <int>(), placeableContents = dungeonPlaceable }; bool flag = layer > 0; bool flag2 = flag; if (flag2) { RoomFactory.AddObjectDataToReinforcementLayer(room, prototypePlacedObjectData, layer - 1, location); } else { room.placedObjects.Add(prototypePlacedObjectData); room.placedObjectPositions.Add(location); } bool flag3 = !room.roomEvents.Contains(RoomFactory.sealOnEnterWithEnemies); bool flag4 = flag3; if (flag4) { room.roomEvents.Add(RoomFactory.sealOnEnterWithEnemies); } bool flag5 = !room.roomEvents.Contains(RoomFactory.unsealOnRoomClear); bool flag6 = flag5; if (flag6) { room.roomEvents.Add(RoomFactory.unsealOnRoomClear); } }
public static DungeonPlaceable GetPlaceableFromBundles(string assetPath) { DungeonPlaceable placeable = null; foreach (var bundle in StaticReferences.AssetBundles.Values) { placeable = bundle.LoadAsset <DungeonPlaceable>(assetPath); if (placeable) { break; } } return(placeable); }
public static void AddEnemyToRoom(PrototypeDungeonRoom room, Vector2 location, string guid, int layer, bool shuffle) { DungeonPlaceable placeableContents = ScriptableObject.CreateInstance <DungeonPlaceable>(); placeableContents.width = 1; placeableContents.height = 1; placeableContents.respectsEncounterableDifferentiator = true; placeableContents.variantTiers = new List <DungeonPlaceableVariant>() { new DungeonPlaceableVariant() { percentChance = 1, prerequisites = new DungeonPrerequisite[0], enemyPlaceableGuid = guid, materialRequirements = new DungeonPlaceableRoomMaterialRequirement[0], } }; PrototypePlacedObjectData objectData = new PrototypePlacedObjectData() { contentsBasePosition = location, fieldData = new List <PrototypePlacedObjectFieldData>(), instancePrerequisites = new DungeonPrerequisite[0], linkedTriggerAreaIDs = new List <int>(), placeableContents = placeableContents, }; if (layer > 0) { AddObjectDataToReinforcementLayer(room, objectData, layer - 1, location, shuffle); } else { room.placedObjects.Add(objectData); room.placedObjectPositions.Add(location); } if (!room.roomEvents.Contains(sealOnEnterWithEnemies)) { room.roomEvents.Add(sealOnEnterWithEnemies); } if (!room.roomEvents.Contains(unsealOnRoomClear)) { room.roomEvents.Add(unsealOnRoomClear); } }
protected override void DoEffect(PlayerController user) { float roomPosX = user.transform.position.x - user.CurrentRoom.area.basePosition.x; float roomPosY = user.transform.position.y - user.CurrentRoom.area.basePosition.y; float xOffSet = 1; float yOffSet = 0; Vector2 posInCurrentRoom = new Vector2(roomPosX + xOffSet, roomPosY + yOffSet); GameObject regularbarrel = sharedAssets2.LoadAsset <GameObject>("Barrel_collection"); GameObject barrelPrefab = FakePrefab.Clone(regularbarrel); DungeonPlaceable woodbox = sharedAssets2.LoadAsset <DungeonPlaceable>("Barrel_collection"); woodbox.InstantiateObject(user.CurrentRoom, posInCurrentRoom.ToIntVector2()); bool flag = woodbox != null; if (flag) { woodbox.InstantiateObject(user.CurrentRoom, posInCurrentRoom.ToIntVector2()); } }
public void ConfigureOnPlacement(RoomHandler room) { gameObject.SetActive(true); enabled = true; IntVector2 SpawnPosition = (gameObject.transform.PositionVector2().ToIntVector2() - room.area.basePosition); Vector2 NodePosition = SpawnPosition.ToVector2(); SerializedPath SawBladePath = GenerateRectanglePathInset(NodePosition, PathNodeAreaSize); room.area.prototypeRoom.paths.Add(SawBladePath); DungeonPlaceable m_TrapPlacable = BraveResources.Load <DungeonPlaceable>("RobotDaveTraps", ".asset"); GameObject sawbladePrefab = null; if (m_TrapPlacable) { sawbladePrefab = m_TrapPlacable.variantTiers[0].nonDatabasePlaceable; } if (sawbladePrefab) { GameObject m_PlacedSawBlade = Instantiate(sawbladePrefab, gameObject.transform.position, Quaternion.identity); m_PlacedSawBlade.SetActive(false); if (m_PlacedSawBlade) { PathMover SawPathMover = m_PlacedSawBlade.GetComponent <PathMover>(); if (SawPathMover != null) { SawPathMover.RoomHandler = room; SawPathMover.Path = SawBladePath; SawPathMover.PathStartNode = Random.Range(0, SawBladePath.nodes.Count); SawPathMover.IsUsingAlternateTargets = false; SawPathMover.ForceCornerDelayHack = false; SawPathMover.nodeOffset = PathNodeOffset; m_PlacedSawBlade.SetActive(true); } } } }
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; }
public static DungeonPlaceable GenerateDungeonPlacable(GameObject ObjectPrefab = null, bool spawnsEnemy = false, bool useExternalPrefab = false, bool spawnsItem = false, string EnemyGUID = "479556d05c7c44f3b6abb3b2067fc778", int itemID = 307, Vector2?CustomOffset = null, bool itemHasDebrisObject = true, float spawnChance = 1f) { AssetBundle m_assetBundle = ResourceManager.LoadAssetBundle("shared_auto_001"); AssetBundle m_assetBundle2 = ResourceManager.LoadAssetBundle("shared_auto_002"); AssetBundle m_resourceBundle = ResourceManager.LoadAssetBundle("brave_resources_001"); // Used with custom DungeonPlacable GameObject ChestBrownTwoItems = m_assetBundle.LoadAsset <GameObject>("Chest_Wood_Two_Items"); GameObject Chest_Silver = m_assetBundle.LoadAsset <GameObject>("chest_silver"); GameObject Chest_Green = m_assetBundle.LoadAsset <GameObject>("chest_green"); GameObject Chest_Synergy = m_assetBundle.LoadAsset <GameObject>("chest_synergy"); GameObject Chest_Red = m_assetBundle.LoadAsset <GameObject>("chest_red"); GameObject Chest_Black = m_assetBundle.LoadAsset <GameObject>("Chest_Black"); GameObject Chest_Rainbow = m_assetBundle.LoadAsset <GameObject>("Chest_Rainbow"); // GameObject Chest_Rat = m_assetBundle.LoadAsset<GameObject>("Chest_Rat"); m_assetBundle = null; m_assetBundle2 = null; m_resourceBundle = null; DungeonPlaceableVariant BlueChestVariant = new DungeonPlaceableVariant(); BlueChestVariant.percentChance = 0.35f; BlueChestVariant.unitOffset = new Vector2(1, 0.8f); BlueChestVariant.enemyPlaceableGuid = string.Empty; BlueChestVariant.pickupObjectPlaceableId = -1; BlueChestVariant.forceBlackPhantom = false; BlueChestVariant.addDebrisObject = false; BlueChestVariant.prerequisites = null; BlueChestVariant.materialRequirements = null; BlueChestVariant.nonDatabasePlaceable = Chest_Silver; DungeonPlaceableVariant BrownChestVariant = new DungeonPlaceableVariant(); BrownChestVariant.percentChance = 0.28f; BrownChestVariant.unitOffset = new Vector2(1, 0.8f); BrownChestVariant.enemyPlaceableGuid = string.Empty; BrownChestVariant.pickupObjectPlaceableId = -1; BrownChestVariant.forceBlackPhantom = false; BrownChestVariant.addDebrisObject = false; BrownChestVariant.prerequisites = null; BrownChestVariant.materialRequirements = null; BrownChestVariant.nonDatabasePlaceable = ChestBrownTwoItems; DungeonPlaceableVariant GreenChestVariant = new DungeonPlaceableVariant(); GreenChestVariant.percentChance = 0.25f; GreenChestVariant.unitOffset = new Vector2(1, 0.8f); GreenChestVariant.enemyPlaceableGuid = string.Empty; GreenChestVariant.pickupObjectPlaceableId = -1; GreenChestVariant.forceBlackPhantom = false; GreenChestVariant.addDebrisObject = false; GreenChestVariant.prerequisites = null; GreenChestVariant.materialRequirements = null; GreenChestVariant.nonDatabasePlaceable = Chest_Green; DungeonPlaceableVariant SynergyChestVariant = new DungeonPlaceableVariant(); SynergyChestVariant.percentChance = 0.2f; SynergyChestVariant.unitOffset = new Vector2(1, 0.8f); SynergyChestVariant.enemyPlaceableGuid = string.Empty; SynergyChestVariant.pickupObjectPlaceableId = -1; SynergyChestVariant.forceBlackPhantom = false; SynergyChestVariant.addDebrisObject = false; SynergyChestVariant.prerequisites = null; SynergyChestVariant.materialRequirements = null; SynergyChestVariant.nonDatabasePlaceable = Chest_Synergy; DungeonPlaceableVariant RedChestVariant = new DungeonPlaceableVariant(); RedChestVariant.percentChance = 0.15f; RedChestVariant.unitOffset = new Vector2(0.5f, 0.5f); RedChestVariant.enemyPlaceableGuid = string.Empty; RedChestVariant.pickupObjectPlaceableId = -1; RedChestVariant.forceBlackPhantom = false; RedChestVariant.addDebrisObject = false; RedChestVariant.prerequisites = null; RedChestVariant.materialRequirements = null; RedChestVariant.nonDatabasePlaceable = Chest_Red; DungeonPlaceableVariant BlackChestVariant = new DungeonPlaceableVariant(); BlackChestVariant.percentChance = 0.1f; BlackChestVariant.unitOffset = new Vector2(0.5f, 0.5f); BlackChestVariant.enemyPlaceableGuid = string.Empty; BlackChestVariant.pickupObjectPlaceableId = -1; BlackChestVariant.forceBlackPhantom = false; BlackChestVariant.addDebrisObject = false; BlackChestVariant.prerequisites = null; BlackChestVariant.materialRequirements = null; BlackChestVariant.nonDatabasePlaceable = Chest_Black; DungeonPlaceableVariant RainbowChestVariant = new DungeonPlaceableVariant(); RainbowChestVariant.percentChance = 0.005f; RainbowChestVariant.unitOffset = new Vector2(0.5f, 0.5f); RainbowChestVariant.enemyPlaceableGuid = string.Empty; RainbowChestVariant.pickupObjectPlaceableId = -1; RainbowChestVariant.forceBlackPhantom = false; RainbowChestVariant.addDebrisObject = false; RainbowChestVariant.prerequisites = null; RainbowChestVariant.materialRequirements = null; RainbowChestVariant.nonDatabasePlaceable = Chest_Rainbow; DungeonPlaceableVariant ItemVariant = new DungeonPlaceableVariant(); ItemVariant.percentChance = spawnChance; if (CustomOffset.HasValue) { ItemVariant.unitOffset = CustomOffset.Value; } else { ItemVariant.unitOffset = Vector2.zero; } // ItemVariant.unitOffset = new Vector2(0.5f, 0.8f); ItemVariant.enemyPlaceableGuid = string.Empty; ItemVariant.pickupObjectPlaceableId = itemID; ItemVariant.forceBlackPhantom = false; if (itemHasDebrisObject) { ItemVariant.addDebrisObject = true; } else { ItemVariant.addDebrisObject = false; } RainbowChestVariant.prerequisites = null; RainbowChestVariant.materialRequirements = null; List <DungeonPlaceableVariant> ChestTiers = new List <DungeonPlaceableVariant>(); ChestTiers.Add(BrownChestVariant); ChestTiers.Add(BlueChestVariant); ChestTiers.Add(GreenChestVariant); ChestTiers.Add(SynergyChestVariant); ChestTiers.Add(RedChestVariant); ChestTiers.Add(BlackChestVariant); ChestTiers.Add(RainbowChestVariant); DungeonPlaceableVariant EnemyVariant = new DungeonPlaceableVariant(); EnemyVariant.percentChance = spawnChance; EnemyVariant.unitOffset = Vector2.zero; EnemyVariant.enemyPlaceableGuid = EnemyGUID; EnemyVariant.pickupObjectPlaceableId = -1; EnemyVariant.forceBlackPhantom = false; EnemyVariant.addDebrisObject = false; EnemyVariant.prerequisites = null; EnemyVariant.materialRequirements = null; List <DungeonPlaceableVariant> EnemyTiers = new List <DungeonPlaceableVariant>(); EnemyTiers.Add(EnemyVariant); List <DungeonPlaceableVariant> ItemTiers = new List <DungeonPlaceableVariant>(); ItemTiers.Add(ItemVariant); DungeonPlaceable m_cachedCustomPlacable = ScriptableObject.CreateInstance <DungeonPlaceable>(); m_cachedCustomPlacable.name = "CustomChestPlacable"; if (spawnsEnemy | useExternalPrefab) { m_cachedCustomPlacable.width = 2; m_cachedCustomPlacable.height = 2; } else if (spawnsItem) { m_cachedCustomPlacable.width = 1; m_cachedCustomPlacable.height = 1; } else { m_cachedCustomPlacable.width = 4; m_cachedCustomPlacable.height = 1; } m_cachedCustomPlacable.roomSequential = false; m_cachedCustomPlacable.respectsEncounterableDifferentiator = true; m_cachedCustomPlacable.UsePrefabTransformOffset = false; m_cachedCustomPlacable.isPassable = true; if (spawnsItem) { m_cachedCustomPlacable.MarkSpawnedItemsAsRatIgnored = true; } else { m_cachedCustomPlacable.MarkSpawnedItemsAsRatIgnored = false; } m_cachedCustomPlacable.DebugThisPlaceable = false; if (useExternalPrefab && ObjectPrefab != null) { DungeonPlaceableVariant ExternalObjectVariant = new DungeonPlaceableVariant(); ExternalObjectVariant.percentChance = spawnChance; if (CustomOffset.HasValue) { ExternalObjectVariant.unitOffset = CustomOffset.Value; } else { ExternalObjectVariant.unitOffset = Vector2.zero; } ExternalObjectVariant.enemyPlaceableGuid = string.Empty; ExternalObjectVariant.pickupObjectPlaceableId = -1; ExternalObjectVariant.forceBlackPhantom = false; ExternalObjectVariant.addDebrisObject = false; ExternalObjectVariant.nonDatabasePlaceable = ObjectPrefab; List <DungeonPlaceableVariant> ExternalObjectTiers = new List <DungeonPlaceableVariant>(); ExternalObjectTiers.Add(ExternalObjectVariant); m_cachedCustomPlacable.variantTiers = ExternalObjectTiers; } else if (spawnsEnemy) { m_cachedCustomPlacable.variantTiers = EnemyTiers; } else if (spawnsItem) { m_cachedCustomPlacable.variantTiers = ItemTiers; } else { m_cachedCustomPlacable.variantTiers = ChestTiers; } return(m_cachedCustomPlacable); }
public static void AddObjectToRoom(PrototypeDungeonRoom room, Vector2 position, DungeonPlaceable PlacableContents = null, DungeonPlaceableBehaviour NonEnemyBehaviour = null, string EnemyBehaviourGuid = null, float SpawnChance = 1f, int xOffset = 0, int yOffset = 0, int layer = 0) { 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 = null, 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 }; if (PlacableContents != null) { m_NewObjectData.placeableContents = PlacableContents; } else if (NonEnemyBehaviour != null) { m_NewObjectData.nonenemyBehaviour = NonEnemyBehaviour; } else if (EnemyBehaviourGuid != null) { m_NewObjectData.enemyBehaviourGuid = EnemyBehaviourGuid; } else { // All possible object fields were left null? Do nothing and return if this is the case. return; } room.placedObjects.Add(m_NewObjectData); room.placedObjectPositions.Add(position); return; }
public static void AddExitToRoom(PrototypeDungeonRoom room, Vector2 ExitLocation, DungeonData.Direction ExitDirection, PrototypeRoomExit.ExitType ExitType = PrototypeRoomExit.ExitType.NO_RESTRICTION, PrototypeRoomExit.ExitGroup ExitGroup = PrototypeRoomExit.ExitGroup.A, bool ContainsDoor = true, int ExitLength = 3, int exitSize = 2, DungeonPlaceable overrideDoorObject = null) { if (room == null) { return; } if (room.exitData == null) { room.exitData = new PrototypeRoomExitData(); room.exitData.exits = new List <PrototypeRoomExit>(); } if (room.exitData.exits == null) { room.exitData.exits = new List <PrototypeRoomExit>(); } PrototypeRoomExit m_NewExit = new PrototypeRoomExit(ExitDirection, ExitLocation) { exitDirection = ExitDirection, exitType = ExitType, exitGroup = ExitGroup, containsDoor = ContainsDoor, exitLength = ExitLength, containedCells = new List <Vector2>(), }; if (ExitDirection == DungeonData.Direction.WEST | ExitDirection == DungeonData.Direction.EAST) { if (exitSize > 2) { m_NewExit.containedCells.Add(ExitLocation); m_NewExit.containedCells.Add(ExitLocation + new Vector2(0, 1)); for (int i = 2; i < exitSize; i++) { m_NewExit.containedCells.Add(ExitLocation + new Vector2(0, i)); } } else { m_NewExit.containedCells.Add(ExitLocation); m_NewExit.containedCells.Add(ExitLocation + new Vector2(0, 1)); } } else { if (exitSize > 2) { m_NewExit.containedCells.Add(ExitLocation); m_NewExit.containedCells.Add(ExitLocation + new Vector2(1, 0)); for (int i = 2; i < exitSize; i++) { m_NewExit.containedCells.Add(ExitLocation + new Vector2(i, 0)); } } else { m_NewExit.containedCells.Add(ExitLocation); m_NewExit.containedCells.Add(ExitLocation + new Vector2(1, 0)); } } if (overrideDoorObject) { m_NewExit.specifiedDoor = overrideDoorObject; } room.exitData.exits.Add(m_NewExit); }
protected override void DoEffect(PlayerController user) { base.DoEffect(user); AkSoundEngine.PostEvent("m_ENM_amulet_conjure_01", base.gameObject); if (user.CurrentRoom != null) { float roomPosX = user.transform.position.x - user.CurrentRoom.area.basePosition.x; float roomPosY = user.transform.position.y - user.CurrentRoom.area.basePosition.y; float xOffSet = 0; float yOffSet = 0; float thexOffSet = 0; float theyOffSet = 0; float offsetAmount = 2f; float gunCurrentAngle = BraveMathCollege.Atan2Degrees(this.LastOwner.unadjustedAimPoint.XY() - this.LastOwner.CenterPosition); if (gunCurrentAngle > 45f && gunCurrentAngle <= 135f) { yOffSet = offsetAmount; //up } else if ((gunCurrentAngle > 0 && gunCurrentAngle > 135f) || (gunCurrentAngle < 0 && gunCurrentAngle <= -135f)) { xOffSet = -offsetAmount; //left } else if (gunCurrentAngle > -135f && gunCurrentAngle <= -45f) { yOffSet = -offsetAmount; //bottom } else { xOffSet = offsetAmount; //right } if (gunCurrentAngle > 45f && gunCurrentAngle <= 135f) { theyOffSet = -offsetAmount; //up } else if ((gunCurrentAngle > 0 && gunCurrentAngle > 135f) || (gunCurrentAngle < 0 && gunCurrentAngle <= -135f)) { thexOffSet = offsetAmount; //left } else if (gunCurrentAngle > -135f && gunCurrentAngle <= -45f) { theyOffSet = offsetAmount; //bottom } else { thexOffSet = -offsetAmount; //right } Vector2 posInCurrentRoom = new Vector2(roomPosX + xOffSet, roomPosY + yOffSet); Vector2 posInCurrentRoom2 = new Vector2(roomPosX + thexOffSet, roomPosY + theyOffSet); Vector2 posInMap = new Vector2(user.transform.position.x + xOffSet, user.transform.position.y + yOffSet).ToIntVector2().ToVector2(); Vector2 posInMap2 = new Vector2(user.transform.position.x + thexOffSet, user.transform.position.y + theyOffSet).ToIntVector2().ToVector2(); if (user.IsValidPlayerPosition(posInMap)) { AssetBundle sharedAssets2d = ResourceManager.LoadAssetBundle("shared_auto_002"); AssetBundle sharedAssets2 = ResourceManager.LoadAssetBundle("shared_auto_001"); if (user.HasPickupID(332)) { DungeonPlaceable ExplodyBarreld = sharedAssets2d.LoadAsset <DungeonPlaceable>("ExplodyBarrel_Maybe"); GameObject spawnedDrumd = ExplodyBarreld.InstantiateObject(user.CurrentRoom, posInCurrentRoom2.ToIntVector2()); } ; DungeonPlaceable ExplodyBarrel = sharedAssets2.LoadAsset <DungeonPlaceable>("Barrel_collection"); GameObject spawnedDrum = ExplodyBarrel.InstantiateObject(user.CurrentRoom, posInCurrentRoom.ToIntVector2()); } } }
private IEnumerator Trigger() { if (m_triggered) { yield break; } if (!string.IsNullOrEmpty(TriggerAnimation)) { spriteAnimator.Play(TriggerAnimation); } if (!string.IsNullOrEmpty(TriggerSFX)) { AkSoundEngine.PostEvent(TriggerSFX, gameObject); } m_triggered = true; Vector2 SpawnOffset = Vector2.zero; if (EnemySpawnOffset.HasValue) { SpawnOffset = EnemySpawnOffset.Value; } if (TriggerVFX) { if (useAirDropSpawn) { m_TriggerVFX = SpawnManager.SpawnVFX(TriggerVFX, specRigidbody.UnitBottomCenter - new Vector2(0, 0.25f), Quaternion.identity); } else { m_TriggerVFX = SpawnManager.SpawnVFX(TriggerVFX, specRigidbody.UnitBottomCenter + SpawnOffset, Quaternion.identity); } } if (useAirDropSpawn) { Vector2 SpawnPosition = transform.position; DungeonPlaceable selectedPlacable = null; bool isExplodyBarrel = false; if (EnemySpawnPlacableOverride) { selectedPlacable = EnemySpawnPlacableOverride; } else { RobotDaveIdea targetIdea = (!GameManager.Instance.Dungeon.UsesCustomFloorIdea) ? GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultProceduralIdea : GameManager.Instance.Dungeon.FloorIdea; selectedPlacable = BraveUtility.RandomElement(targetIdea.ValidEasyEnemyPlaceables); } DungeonPlaceableVariant selectedVarient = BraveUtility.RandomElement(selectedPlacable.variantTiers); if (selectedVarient != null && UnityEngine.Random.value > 0.2f) { if (!string.IsNullOrEmpty(selectedVarient.enemyPlaceableGuid)) { GameObject enemyObject = Instantiate(EnemyDatabase.GetOrLoadByGuid(selectedVarient.enemyPlaceableGuid).gameObject, SpawnPosition, Quaternion.identity); enemyObject.GetComponent <AIActor>().ConfigureOnPlacement(m_room); ExpandUtility.SpawnParaDrop(m_room, SpawnPosition, enemyObject, DropHorizontalOffset: 10, useLandingVFX: false); } else if (selectedVarient.nonDatabasePlaceable) { GameObject ParaDroppedObject = Instantiate(selectedVarient.nonDatabasePlaceable, SpawnPosition, Quaternion.identity); ExpandUtility.SpawnParaDrop(m_room, SpawnPosition, ParaDroppedObject, DropHorizontalOffset: 10, useLandingVFX: false); } else { ExpandUtility.SpawnParaDrop(m_room, SpawnPosition, DropHorizontalOffset: 10, useLandingVFX: false); isExplodyBarrel = true; } } else { ExpandUtility.SpawnParaDrop(m_room, SpawnPosition, DropHorizontalOffset: 10, useLandingVFX: false); isExplodyBarrel = true; } if (!m_room.IsSealed && !isExplodyBarrel) { m_room.SealRoom(); } yield return(null); DestroyMushroom(); } else { AIActor selectedEnemy = null; if (EnemySpawnPlacableOverride) { DungeonPlaceableVariant enemyVariant = EnemySpawnPlacableOverride.SelectFromTiersFull(); selectedEnemy = enemyVariant.GetOrLoadPlaceableObject.GetComponent <AIActor>(); } else { RobotDaveIdea targetIdea = (!GameManager.Instance.Dungeon.UsesCustomFloorIdea) ? GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultProceduralIdea : GameManager.Instance.Dungeon.FloorIdea; DungeonPlaceable backupEnemyPlaceable = targetIdea.ValidEasyEnemyPlaceables[UnityEngine.Random.Range(0, targetIdea.ValidEasyEnemyPlaceables.Length)]; DungeonPlaceableVariant enemyVariant = backupEnemyPlaceable.SelectFromTiersFull(); } if (selectedEnemy) { AIActor targetAIActor = AIActor.Spawn(selectedEnemy, specRigidbody.UnitCenter.ToIntVector2(VectorConversions.Floor) + SpawnOffset.ToIntVector2(), m_room, true, AIActor.AwakenAnimationType.Spawn, true); targetAIActor.reinforceType = AIActor.ReinforceType.SkipVfx; targetAIActor.HandleReinforcementFallIntoRoom(0.8f); if (!m_room.IsSealed) { m_room.SealRoom(); } while (targetAIActor.IsGone) { yield return(null); } DestroyMushroom(); } } yield break; }
private IEnumerator Trigger() { if (m_triggered) { yield break; } if (!string.IsNullOrEmpty(TriggerAnimation)) { spriteAnimator.Play(TriggerAnimation); } if (!string.IsNullOrEmpty(TriggerSFX)) { AkSoundEngine.PostEvent(TriggerSFX, gameObject); } m_triggered = true; Vector2 SpawnOffset = Vector2.zero; if (EnemySpawnOffset.HasValue) { SpawnOffset = EnemySpawnOffset.Value; } if (TriggerVFX) { SpawnManager.SpawnVFX(TriggerVFX, specRigidbody.UnitCenter + SpawnOffset, Quaternion.identity); } if (useAirDropSpawn) { EmergencyCrateController spawnedEnemyCrate = null; if (!EnemySpawnPlacableOverride) { RobotDaveIdea targetIdea = (!GameManager.Instance.Dungeon.UsesCustomFloorIdea) ? GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultProceduralIdea : GameManager.Instance.Dungeon.FloorIdea; GameObject eCrateInstance = ExpandUtility.SpawnAirDrop(m_room, sprite.WorldCenter, null, targetIdea.ValidEasyEnemyPlaceables[UnityEngine.Random.Range(0, targetIdea.ValidEasyEnemyPlaceables.Length)], 0.2f); if (eCrateInstance) { spawnedEnemyCrate = eCrateInstance.GetComponent <EmergencyCrateController>(); } // spawnedEnemyCrate = EnemyAirDrop(m_room, sprite.WorldCenter, targetIdea.ValidEasyEnemyPlaceables[UnityEngine.Random.Range(0, targetIdea.ValidEasyEnemyPlaceables.Length)]); } else { // spawnedEnemyCrate = EnemyAirDrop(m_room, sprite.WorldCenter, EnemySpawnPlacableOverride); GameObject eCrateInstance = ExpandUtility.SpawnAirDrop(m_room, sprite.WorldCenter, null, EnemySpawnPlacableOverride, 0.2f); if (eCrateInstance) { spawnedEnemyCrate = eCrateInstance.GetComponent <EmergencyCrateController>(); } } if (!m_room.IsSealed && spawnedEnemyCrate) { m_room.npcSealState = RoomHandler.NPCSealState.SealAll; m_room.SealRoom(); } yield return(new WaitForSeconds(2.25f)); DestroyMushroom(false); if (spawnedEnemyCrate) { while (ReflectionHelpers.ReflectGetField <bool?>(typeof(EmergencyCrateController), "m_hasBeenTriggered", spawnedEnemyCrate).HasValue&& ReflectionHelpers.ReflectGetField <bool?>(typeof(EmergencyCrateController), "m_hasBeenTriggered", spawnedEnemyCrate).Value) { if (!spawnedEnemyCrate) { break; } yield return(null); } } yield return(new WaitForSeconds(1f)); m_room.npcSealState = RoomHandler.NPCSealState.SealNone; if (spriteAnimator.IsPlaying(BreakAnimation)) { while (spriteAnimator.IsPlaying(BreakAnimation)) { yield return(null); } } Destroy(gameObject); } else { AIActor selectedEnemy = null; if (EnemySpawnPlacableOverride) { DungeonPlaceableVariant enemyVariant = EnemySpawnPlacableOverride.SelectFromTiersFull(); selectedEnemy = enemyVariant.GetOrLoadPlaceableObject.GetComponent <AIActor>(); } else { RobotDaveIdea targetIdea = (!GameManager.Instance.Dungeon.UsesCustomFloorIdea) ? GameManager.Instance.Dungeon.sharedSettingsPrefab.DefaultProceduralIdea : GameManager.Instance.Dungeon.FloorIdea; DungeonPlaceable backupEnemyPlaceable = targetIdea.ValidEasyEnemyPlaceables[UnityEngine.Random.Range(0, targetIdea.ValidEasyEnemyPlaceables.Length)]; DungeonPlaceableVariant enemyVariant = backupEnemyPlaceable.SelectFromTiersFull(); } if (selectedEnemy) { AIActor targetAIActor = AIActor.Spawn(selectedEnemy, specRigidbody.UnitCenter.ToIntVector2(VectorConversions.Floor) + SpawnOffset.ToIntVector2(), m_room, true, AIActor.AwakenAnimationType.Spawn, true); targetAIActor.reinforceType = AIActor.ReinforceType.SkipVfx; targetAIActor.HandleReinforcementFallIntoRoom(0.8f); if (!m_room.IsSealed) { m_room.SealRoom(); } while (targetAIActor.IsGone) { yield return(null); } DestroyMushroom(); } } yield break; }
public static void BuildDatabase() { // Dungeon marinePastDungeon = DungeonDatabase.GetOrLoadByName("finalscenario_soldier"); Dungeon convictPastDungeon = DungeonDatabase.GetOrLoadByName("finalscenario_convict"); Dungeon catacombsDungeon = DungeonDatabase.GetOrLoadByName("base_catacombs"); Dungeon sewersDungeon = DungeonDatabase.GetOrLoadByName("base_sewer"); Dungeon forgeDungeon = DungeonDatabase.GetOrLoadByName("base_forge"); Dungeon gungeonDungeon = DungeonDatabase.GetOrLoadByName("base_gungeon"); Dungeon castleDungeon = DungeonDatabase.GetOrLoadByName("base_castle"); YellowDrum = ExpandAssets.LoadOfficialAsset <GameObject>("Yellow Drum", ExpandAssets.AssetSource.SharedAuto2); RedDrum = ExpandAssets.LoadOfficialAsset <GameObject>("Red Drum", ExpandAssets.AssetSource.SharedAuto1); WaterDrum = ExpandAssets.LoadOfficialAsset <GameObject>("Blue Drum", ExpandAssets.AssetSource.SharedAuto2); OilDrum = ExpandAssets.LoadOfficialAsset <GameObject>("Purple Drum", ExpandAssets.AssetSource.SharedAuto2); IceBomb = ExpandAssets.LoadOfficialAsset <GameObject>("Ice Cube Bomb", ExpandAssets.AssetSource.SharedAuto2); TableHorizontal = ExpandAssets.LoadOfficialAsset <GameObject>("Table_Horizontal", ExpandAssets.AssetSource.SharedAuto1); TableVertical = ExpandAssets.LoadOfficialAsset <GameObject>("Table_Vertical", ExpandAssets.AssetSource.SharedAuto1); TableHorizontalStone = ExpandAssets.LoadOfficialAsset <GameObject>("Table_Horizontal_Stone", ExpandAssets.AssetSource.SharedAuto1); TableVerticalStone = ExpandAssets.LoadOfficialAsset <GameObject>("Table_Vertical_Stone", ExpandAssets.AssetSource.SharedAuto1); NPCOldMan = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_Old_Man", ExpandAssets.AssetSource.SharedAuto1); NPCSynergrace = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_Synergrace", ExpandAssets.AssetSource.SharedAuto1); NPCTonic = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_Tonic", ExpandAssets.AssetSource.SharedAuto1); NPCCursola = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_Curse_Jailed", ExpandAssets.AssetSource.SharedAuto2); NPCGunMuncher = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_GunberMuncher", ExpandAssets.AssetSource.SharedAuto2); NPCEvilMuncher = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_GunberMuncher_Evil", ExpandAssets.AssetSource.SharedAuto1); NPCMonsterManuel = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_Monster_Manuel", ExpandAssets.AssetSource.SharedAuto1); NPCVampire = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_Vampire", ExpandAssets.AssetSource.SharedAuto2); NPCGuardLeft = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_Guardian_Left", ExpandAssets.AssetSource.SharedAuto2); NPCGuardRight = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_Guardian_Right", ExpandAssets.AssetSource.SharedAuto2); NPCTruthKnower = ExpandAssets.LoadOfficialAsset <GameObject>("NPC_Truth_Knower", ExpandAssets.AssetSource.SharedAuto1); NPCHeartDispenser = ExpandAssets.LoadOfficialAsset <GameObject>("HeartDispenser", ExpandAssets.AssetSource.SharedAuto2); AmygdalaNorth = ExpandAssets.LoadOfficialAsset <GameObject>("Amygdala_North", ExpandAssets.AssetSource.BraveResources); AmygdalaSouth = ExpandAssets.LoadOfficialAsset <GameObject>("Amygdala_South", ExpandAssets.AssetSource.BraveResources); AmygdalaWest = ExpandAssets.LoadOfficialAsset <GameObject>("Amygdala_West", ExpandAssets.AssetSource.BraveResources); AmygdalaEast = ExpandAssets.LoadOfficialAsset <GameObject>("Amygdala_East", ExpandAssets.AssetSource.BraveResources); SpaceFog = ExpandAssets.LoadOfficialAsset <GameObject>("Space Fog", ExpandAssets.AssetSource.BraveResources); LockedDoor = ExpandAssets.LoadOfficialAsset <GameObject>("SimpleLockedDoor", ExpandAssets.AssetSource.SharedAuto2); LockedJailDoor = ExpandAssets.LoadOfficialAsset <GameObject>("JailDoor", ExpandAssets.AssetSource.SharedAuto2); SpikeTrap = ExpandAssets.LoadOfficialAsset <GameObject>("trap_spike_gungeon_2x2", ExpandAssets.AssetSource.SharedAuto1); FlameTrap = ExpandAssets.LoadOfficialAsset <GameObject>("trap_flame_poofy_gungeon_1x1", ExpandAssets.AssetSource.SharedAuto2); FakeTrap = ExpandAssets.LoadOfficialAsset <GameObject>("trap_pit_gungeon_trigger_2x2", ExpandAssets.AssetSource.SharedAuto1); PlayerCorpse = ExpandAssets.LoadOfficialAsset <GameObject>("PlayerCorpse", ExpandAssets.AssetSource.BraveResources); TimefallCorpse = ExpandAssets.LoadOfficialAsset <GameObject>("TimefallCorpse", ExpandAssets.AssetSource.BraveResources); ThoughtBubble = ExpandAssets.LoadOfficialAsset <GameObject>("ThoughtBubble", ExpandAssets.AssetSource.BraveResources); HangingPot = ExpandAssets.LoadOfficialAsset <GameObject>("Hanging_Pot", ExpandAssets.AssetSource.SharedAuto1); DoorsVertical = ExpandAssets.LoadOfficialAsset <GameObject>("GungeonShopDoor_Vertical", ExpandAssets.AssetSource.SharedAuto2); DoorsHorizontal = ExpandAssets.LoadOfficialAsset <GameObject>("GungeonShopDoor_Horizontal", ExpandAssets.AssetSource.SharedAuto2); DoorsHorizontal_Catacombs = catacombsDungeon.doorObjects.variantTiers[0].nonDatabasePlaceable; DoorsVertical_Catacombs = catacombsDungeon.doorObjects.variantTiers[1].nonDatabasePlaceable; BigDoorsHorizontal = ExpandAssets.LoadOfficialAsset <GameObject>("IronWoodDoor_Horizontal_Gungeon", ExpandAssets.AssetSource.SharedAuto2); BigDoorsVertical = ExpandAssets.LoadOfficialAsset <GameObject>("IronWoodDoor_Vertical_Gungeon", ExpandAssets.AssetSource.SharedAuto2); RatTrapDoorIcon = ExpandAssets.LoadOfficialAsset <GameObject>("RatTrapdoorMinimapIcon", ExpandAssets.AssetSource.BraveResources); CultistBaldBowBackLeft = ExpandAssets.LoadOfficialAsset <GameObject>("CultistBaldBowBackLeft_cutout", ExpandAssets.AssetSource.SharedAuto2); CultistBaldBowBackRight = ExpandAssets.LoadOfficialAsset <GameObject>("CultistBaldBowBackRight_cutout", ExpandAssets.AssetSource.SharedAuto2); CultistBaldBowBack = ExpandAssets.LoadOfficialAsset <GameObject>("CultistBaldBowBack_cutout", ExpandAssets.AssetSource.SharedAuto2); CultistBaldBowLeft = ExpandAssets.LoadOfficialAsset <GameObject>("CultistBaldBowLeft_cutout", ExpandAssets.AssetSource.SharedAuto2); CultistHoodBowBack = ExpandAssets.LoadOfficialAsset <GameObject>("CultistHoodBowBack_cutout", ExpandAssets.AssetSource.SharedAuto2); CultistHoodBowLeft = ExpandAssets.LoadOfficialAsset <GameObject>("CultistHoodBowLeft_cutout", ExpandAssets.AssetSource.SharedAuto2); CultistHoodBowRight = ExpandAssets.LoadOfficialAsset <GameObject>("CultistHoodBowRight_cutout", ExpandAssets.AssetSource.SharedAuto2); ForgeHammer = ExpandAssets.LoadOfficialAsset <GameObject>("Forge_Hammer", ExpandAssets.AssetSource.SharedAuto1); ChestBrownTwoItems = ExpandAssets.LoadOfficialAsset <GameObject>("Chest_Wood_Two_Items", ExpandAssets.AssetSource.SharedAuto1); ChestTruth = ExpandAssets.LoadOfficialAsset <GameObject>("TruthChest", ExpandAssets.AssetSource.SharedAuto1); ChestBlue = ChestTruth = ExpandAssets.LoadOfficialAsset <GameObject>("Chest_Silver", ExpandAssets.AssetSource.SharedAuto1); ChestRed = ChestTruth = ExpandAssets.LoadOfficialAsset <GameObject>("Chest_Red", ExpandAssets.AssetSource.SharedAuto1); ChestBlack = ChestTruth = ExpandAssets.LoadOfficialAsset <GameObject>("Chest_Black", ExpandAssets.AssetSource.SharedAuto1); ChestRat = ExpandAssets.LoadOfficialAsset <GameObject>("Chest_Rat", ExpandAssets.AssetSource.SharedAuto1); ChestMirror = ExpandAssets.LoadOfficialAsset <GameObject>("Shrine_Mirror", ExpandAssets.AssetSource.SharedAuto1); WinchesterMinimapIcon = ExpandAssets.LoadOfficialAsset <GameObject>("minimap_winchester_icon", ExpandAssets.AssetSource.SharedAuto1); GatlingGullNest = ExpandAssets.LoadOfficialAsset <GameObject>("gatlinggullnest", ExpandAssets.AssetSource.SharedAuto1); BabyDragunNPC = ExpandAssets.LoadOfficialAsset <GameObject>("BabyDragunJail", ExpandAssets.AssetSource.SharedAuto2); GungeonLightStone = ExpandAssets.LoadOfficialAsset <GameObject>("Gungeon Light (Stone)", ExpandAssets.AssetSource.SharedAuto1); GungeonLightPurple = ExpandAssets.LoadOfficialAsset <GameObject>("Gungeon Light (Purple)", ExpandAssets.AssetSource.SharedAuto1); Sconce_Light = ExpandAssets.LoadOfficialAsset <GameObject>("Sconce_Light", ExpandAssets.AssetSource.SharedAuto1); Sconce_Light_Side = ExpandAssets.LoadOfficialAsset <GameObject>("Sconce_Light_Side", ExpandAssets.AssetSource.SharedAuto1); DefaultTorch = ExpandAssets.LoadOfficialAsset <GameObject>("DefaultTorch", ExpandAssets.AssetSource.SharedAuto1); DefaultTorchSide = ExpandAssets.LoadOfficialAsset <GameObject>("DefaultTorchSide", ExpandAssets.AssetSource.SharedAuto1); // GungeonWarpDoor = gungeonDungeon.WarpWingDoorPrefab; // CastleWarpDoor = castleDungeon.WarpWingDoorPrefab; EndTimes = ExpandAssets.LoadOfficialAsset <GameObject>("EndTimes", ExpandAssets.AssetSource.BraveResources); foreach (WeightedRoom wRoom in sewersDungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements) { if (wRoom.room != null && !string.IsNullOrEmpty(wRoom.room.name)) { if (wRoom.room.name.ToLower().StartsWith("sewer_trash_compactor_001")) { CrushDoor_Horizontal = wRoom.room.placedObjects[0].nonenemyBehaviour.gameObject; } } } foreach (WeightedRoom wRoom in forgeDungeon.PatternSettings.flows[0].fallbackRoomTable.includedRooms.elements) { if (wRoom.room != null && !string.IsNullOrEmpty(wRoom.room.name)) { if (wRoom.room.name.ToLower().StartsWith("forge_normal_cubulead_03")) { CrushDoor_Vertical = wRoom.room.placedObjects[0].nonenemyBehaviour.gameObject; } } } // Dungeon Placables ExplodyBarrel = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("ExplodyBarrel_Maybe", ExpandAssets.AssetSource.SharedAuto2); CoffinVertical = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Vertical Coffin", ExpandAssets.AssetSource.SharedAuto2); CoffinHorizontal = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Horizontal Coffin", ExpandAssets.AssetSource.SharedAuto2); Brazier = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Brazier", ExpandAssets.AssetSource.SharedAuto1); CursedPot = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Curse Pot", ExpandAssets.AssetSource.SharedAuto1); Sarcophogus = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Sarcophogus", ExpandAssets.AssetSource.SharedAuto1); GodRays = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Godrays_placeable", ExpandAssets.AssetSource.SharedAuto1); SpecialTraps = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("RobotDaveTraps", ExpandAssets.AssetSource.BraveResources); PitTrap = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Pit Trap", ExpandAssets.AssetSource.SharedAuto2); Bush = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Bush", ExpandAssets.AssetSource.SharedAuto2); BushFlowers = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Bush Flowers", ExpandAssets.AssetSource.SharedAuto2); WoodenBarrel = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Barrel_collection", ExpandAssets.AssetSource.SharedAuto1); WrithingBulletman = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("Writhing Bulletman", ExpandAssets.AssetSource.SharedAuto2); GungeonLockedDoors = gungeonDungeon.lockedDoorObjects; IronWoodDoors = ExpandAssets.LoadOfficialAsset <DungeonPlaceable>("DoorTest", ExpandAssets.AssetSource.SharedAuto2); // DimensionFog = marinePastDungeon.PatternSettings.flows[0].AllNodes[0].overrideExactRoom.placedObjects[0].nonenemyBehaviour.gameObject.transform.Find("DimensionFog").gameObject; ConvictPastController pastController = convictPastDungeon.PatternSettings.flows[0].AllNodes[0].overrideExactRoom.placedObjects[0].nonenemyBehaviour.gameObject.GetComponent <ConvictPastController>(); NightclubCrowdController crowdController = pastController.crowdController; ConvictPastCrowdNPC_01 = crowdController.Dancers[0].gameObject; ConvictPastCrowdNPC_02 = crowdController.Dancers[1].gameObject; ConvictPastCrowdNPC_03 = crowdController.Dancers[2].gameObject; ConvictPastCrowdNPC_04 = crowdController.Dancers[3].gameObject; ConvictPastCrowdNPC_05 = crowdController.Dancers[4].gameObject; ConvictPastCrowdNPC_06 = crowdController.Dancers[5].gameObject; ConvictPastCrowdNPC_07 = crowdController.Dancers[6].gameObject; ConvictPastCrowdNPC_08 = crowdController.Dancers[7].gameObject; ConvictPastCrowdNPC_09 = crowdController.Dancers[8].gameObject; ConvictPastCrowdNPC_10 = crowdController.Dancers[9].gameObject; ConvictPastCrowdNPC_11 = crowdController.Dancers[10].gameObject; ConvictPastCrowdNPC_12 = crowdController.Dancers[11].gameObject; ConvictPastCrowdNPC_13 = crowdController.Dancers[12].gameObject; ConvictPastCrowdNPC_14 = crowdController.Dancers[13].gameObject; ConvictPastCrowdNPC_15 = crowdController.Dancers[14].gameObject; ConvictPastCrowdNPC_16 = crowdController.Dancers[15].gameObject; ConvictPastDancers = new GameObject[] { ConvictPastCrowdNPC_01, ConvictPastCrowdNPC_02, ConvictPastCrowdNPC_03, ConvictPastCrowdNPC_04, ConvictPastCrowdNPC_05, ConvictPastCrowdNPC_06, ConvictPastCrowdNPC_07, ConvictPastCrowdNPC_08, ConvictPastCrowdNPC_09, ConvictPastCrowdNPC_10, ConvictPastCrowdNPC_11, ConvictPastCrowdNPC_12, ConvictPastCrowdNPC_13, ConvictPastCrowdNPC_14, ConvictPastCrowdNPC_15, ConvictPastCrowdNPC_16 }; Mines_Cave_In = ExpandAssets.LoadOfficialAsset <GameObject>("Mines_Cave_In", ExpandAssets.AssetSource.SharedAuto2); Plunger = Mines_Cave_In.GetComponent <HangingObjectController>().triggerObjectPrefab; FoldingTable = PickupObjectDatabase.GetById(644).GetComponent <FoldingTableItem>().TableToSpawn.gameObject; convictPastDungeon = null; catacombsDungeon = null; sewersDungeon = null; forgeDungeon = null; gungeonDungeon = null; castleDungeon = null; }