Пример #1
0
        // Token: 0x06000047 RID: 71 RVA: 0x0000407C File Offset: 0x0000227C
        public static PrototypeDungeonRoom CreateEmptyRoom(int width = 12, int height = 12)
        {
            PrototypeDungeonRoom result;

            try
            {
                PrototypeDungeonRoom newPrototypeDungeonRoom = RoomFactory.GetNewPrototypeDungeonRoom(width, height);
                RoomFactory.AddExit(newPrototypeDungeonRoom, new Vector2((float)(width / 2), (float)height), DungeonData.Direction.NORTH);
                RoomFactory.AddExit(newPrototypeDungeonRoom, new Vector2((float)(width / 2), 0f), DungeonData.Direction.SOUTH);
                RoomFactory.AddExit(newPrototypeDungeonRoom, new Vector2((float)width, (float)(height / 2)), DungeonData.Direction.EAST);
                RoomFactory.AddExit(newPrototypeDungeonRoom, new Vector2(0f, (float)(height / 2)), DungeonData.Direction.WEST);
                PrototypeDungeonRoomCellData[] array = RoomFactory.m_cellData.GetValue(newPrototypeDungeonRoom) as PrototypeDungeonRoomCellData[];
                array = new PrototypeDungeonRoomCellData[width * height];
                for (int i = 0; i < width; i++)
                {
                    for (int j = 0; j < height; j++)
                    {
                        array[i + j * width] = new PrototypeDungeonRoomCellData
                        {
                            state      = CellType.FLOOR,
                            appearance = new PrototypeDungeonRoomCellAppearance
                            {
                                OverrideFloorType = CellVisualData.CellFloorType.Stone
                            }
                        };
                    }
                }
                RoomFactory.m_cellData.SetValue(newPrototypeDungeonRoom, array);
                newPrototypeDungeonRoom.UpdatePrecalculatedData();
                result = newPrototypeDungeonRoom;
            }
            catch (Exception e)
            {
                Tools.PrintException(e, "FF0000");
                result = null;
            }
            return(result);
        }
Пример #2
0
        // Token: 0x0600003E RID: 62 RVA: 0x00003B70 File Offset: 0x00001D70
        public static void ApplyRoomData(PrototypeDungeonRoom room, RoomFactory.RoomData roomData)
        {
            bool flag = roomData.exitPositions != null;

            if (flag)
            {
                for (int i = 0; i < roomData.exitPositions.Length; i++)
                {
                    DungeonData.Direction direction = (DungeonData.Direction)Enum.Parse(typeof(DungeonData.Direction), roomData.exitDirections[i].ToUpper());
                    RoomFactory.AddExit(room, roomData.exitPositions[i], direction);
                }
            }
            else
            {
                RoomFactory.AddExit(room, new Vector2((float)(room.Width / 2), (float)room.Height), DungeonData.Direction.NORTH);
                RoomFactory.AddExit(room, new Vector2((float)(room.Width / 2), 0f), DungeonData.Direction.SOUTH);
                RoomFactory.AddExit(room, new Vector2((float)room.Width, (float)(room.Height / 2)), DungeonData.Direction.EAST);
                RoomFactory.AddExit(room, new Vector2(0f, (float)(room.Height / 2)), DungeonData.Direction.WEST);
            }
            bool flag2 = roomData.enemyPositions != null;

            if (flag2)
            {
                for (int j = 0; j < roomData.enemyPositions.Length; j++)
                {
                    RoomFactory.AddEnemyToRoom(room, roomData.enemyPositions[j], roomData.enemyGUIDs[j], roomData.enemyReinforcementLayers[j]);
                }
            }
            bool flag3 = roomData.placeablePositions != null;

            if (flag3)
            {
                for (int k = 0; k < roomData.placeablePositions.Length; k++)
                {
                    RoomFactory.AddPlaceableToRoom(room, roomData.placeablePositions[k], roomData.placeableGUIDs[k]);
                }
            }
            bool flag4 = roomData.floors != null;

            if (flag4)
            {
                foreach (string val in roomData.floors)
                {
                    room.prerequisites.Add(new DungeonPrerequisite
                    {
                        prerequisiteType = DungeonPrerequisite.PrerequisiteType.TILESET,
                        requiredTileset  = Tools.GetEnumValue <GlobalDungeonData.ValidTilesets>(val)
                    });
                }
            }
            bool flag5 = !string.IsNullOrEmpty(roomData.category);

            if (flag5)
            {
                room.category = Tools.GetEnumValue <PrototypeDungeonRoom.RoomCategory>(roomData.category);
            }
            bool flag6 = !string.IsNullOrEmpty(roomData.normalSubCategory);

            if (flag6)
            {
                room.subCategoryNormal = Tools.GetEnumValue <PrototypeDungeonRoom.RoomNormalSubCategory>(roomData.normalSubCategory);
            }
            bool flag7 = !string.IsNullOrEmpty(roomData.bossSubCategory);

            if (flag7)
            {
                room.subCategoryBoss = Tools.GetEnumValue <PrototypeDungeonRoom.RoomBossSubCategory>(roomData.bossSubCategory);
            }
            bool flag8 = !string.IsNullOrEmpty(roomData.specialSubCatergory);

            if (flag8)
            {
                room.subCategorySpecial = Tools.GetEnumValue <PrototypeDungeonRoom.RoomSpecialSubCategory>(roomData.specialSubCatergory);
            }
        }