Пример #1
0
        // 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);
            }
        }