Exemplo n.º 1
0
        private void Initialize(int level, Point?startTile)
        {
            CurrentLevel         = level;
            CurrentMap           = Data.Maps[level];
            legacyTileCreator    = new LegacyTileCreator(this);
            WallActuatorCreator  = new WallActuatorCreator(this);
            FloorActuatorCreator = new FloorActuatorCreator(this);
            ItemCreator          = new LegacyItemCreator(this);
            creatures            = new List <Creature>();
            InitializeMapTextures();

            outputTiles    = new List <Tile>();
            stack          = new Stack <TileInfo <TileData> >();
            start          = startTile ?? new Point(Data.StartPosition.Position.X, Data.StartPosition.Position.Y);
            TilesPositions = new Dictionary <Point, Tile>();
            bitMap         = new BitMapMemory(CurrentMap.OffsetX, CurrentMap.OffsetY, CurrentMap.Width, CurrentMap.Height);
        }
Exemplo n.º 2
0
        private void SetupFloorItems(Tile tile)
        {
            FloorActuatorCreator.CreateSetupActuators(tile);

            var itemCreator = new LegacyItemCreator(this);
            var tileData    = CurrentMap[tile.GridPosition.X, tile.GridPosition.Y];

            tileData.GrabableItems.ForEach(x => tile.SubItems.Add(itemCreator.CreateItem(x, tile)));

            //TODO creatures
            var creatureCreator = new CreatureCreator(this);

            foreach (var creatre in tileData.Creatures.Where(i => !i.Processed))
            {
                creatures.AddRange(creatureCreator.AddCreature(creatre, tile));
            }
        }
Exemplo n.º 3
0
        public LegacyMapBuilder()
        {
            var parser = new DungeonParser();

            parser.Parse();
            Data = parser.Data;

            ItemCreator = new LegacyItemCreator(this);

            WeaponFactories = Data.WeaponDescriptors
                              .Select(wd =>
            {
                var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Weapon, wd.Identifer);
                return(new WeaponItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor),
                                             ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation),
                                             wd.DeltaEnergy, (WeaponClass)wd.Class, wd.KineticEnergy, wd.ShootDamage, wd.Strength));
            })
                              .ToArray();

            ClothFactories = Data.ArmorDescriptors
                             .Select(wd =>
            {
                var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Clothe, wd.Identifer);
                return(new ClothItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor)
                                            , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation)));
            })
                             .ToArray();;

            ContainerFactories = Data.ContainerDescriptors
                                 .Select(wd =>
            {
                var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Container, wd.Identifer);
                return(new ContainerItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor)
                                                , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation)));
            })
                                 .ToArray();

            ScrollFactories = Data.ScrollDescriptors
                              .Select(wd =>
            {
                var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Scroll, wd.Identifer);
                return(new ScrollItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor)
                                             , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation)));
            })
                              .ToArray();


            MiscFactories = Data.MiscDescriptors
                            .Select(wd =>
            {
                var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Miscellenaous, wd.Identifer);
                return(new MiscItemFactory(wd.Name, wd.Weight, GetAttackFactories(itemDescriptor)
                                           , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation)));
            })
                            .ToArray();

            PotionFactories = Data.PotionDescriptors
                              .Select(p =>
            {
                var itemDescriptor = Data.GetItemDescriptor(ObjectCategory.Potion, p.Identifer);
                return(new PotionItemFactory(p.Name, p.Weight, GetAttackFactories(itemDescriptor)
                                             , ItemCreator.GetStorageTypes(itemDescriptor.CarryLocation)));
            })
                              .ToArray();
        }