Ejemplo n.º 1
0
        public static void ApplyRoomData(PrototypeDungeonRoom room, RoomData roomData)
        {
            if (roomData.exitPositions != null)
            {
                for (int i = 0; i < roomData.exitPositions.Length; i++)
                {
                    DungeonData.Direction dir = (DungeonData.Direction)Enum.Parse(typeof(DungeonData.Direction), roomData.exitDirections[i].ToUpper());
                    AddExit(room, roomData.exitPositions[i], dir);
                }
            }
            else
            {
                AddExit(room, new Vector2(room.Width / 2, room.Height), DungeonData.Direction.NORTH);
                AddExit(room, new Vector2(room.Width / 2, 0), DungeonData.Direction.SOUTH);
                AddExit(room, new Vector2(room.Width, room.Height / 2), DungeonData.Direction.EAST);
                AddExit(room, new Vector2(0, room.Height / 2), DungeonData.Direction.WEST);
            }

            if (roomData.enemyPositions != null)
            {
                for (int i = 0; i < roomData.enemyPositions.Length; i++)
                {
                    AddEnemyToRoom(room, roomData.enemyPositions[i], roomData.enemyGUIDs[i], roomData.enemyReinforcementLayers[i]);
                }
            }

            if (roomData.placeablePositions != null)
            {
                for (int i = 0; i < roomData.placeablePositions.Length; i++)
                {
                    AddPlaceableToRoom(room, roomData.placeablePositions[i], roomData.placeableGUIDs[i]);
                }
            }

            if (roomData.floors != null)
            {
                foreach (var floor in roomData.floors)
                {
                    room.prerequisites.Add(new DungeonPrerequisite()
                    {
                        prerequisiteType = DungeonPrerequisite.PrerequisiteType.TILESET,
                        requiredTileset  = Tools.GetEnumValue <GlobalDungeonData.ValidTilesets>(floor)
                    });
                }
            }
            //Set categories
            if (!string.IsNullOrEmpty(roomData.category))
            {
                room.category = Tools.GetEnumValue <PrototypeDungeonRoom.RoomCategory>(roomData.category);
            }
            if (!string.IsNullOrEmpty(roomData.normalSubCategory))
            {
                room.subCategoryNormal = Tools.GetEnumValue <PrototypeDungeonRoom.RoomNormalSubCategory>(roomData.normalSubCategory);
            }
            if (!string.IsNullOrEmpty(roomData.bossSubCategory))
            {
                room.subCategoryBoss = Tools.GetEnumValue <PrototypeDungeonRoom.RoomBossSubCategory>(roomData.bossSubCategory);
            }
            if (!string.IsNullOrEmpty(roomData.specialSubCatergory))
            {
                room.subCategorySpecial = Tools.GetEnumValue <PrototypeDungeonRoom.RoomSpecialSubCategory>(roomData.specialSubCatergory);
            }
        }
Ejemplo n.º 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);
            }
        }