예제 #1
0
        public ChestButton(Chunk chunk, Vector2 vector, Inventory inventory)
            : base(vector,"      ", chunk.getColor())
        {
            setAction(new SetLootInventoryAction(inventory, chunk));

            this.chunk = chunk;
        }
예제 #2
0
        /// <summary>
        /// Creates a dungeon that is linked to another dungeon through a portalChunk
        /// </summary>
        /// <param name="linkedDungeon">The Dungeon for the portal to link to</param>
        /// <param name="vector">The position to warp to into the other dungeon</param>
        public Dungeon(Dungeon linkedDungeon, Vector2 vector)
        {
            rooms = new RoomContainer();
            random = new Random();

            extraBeginningChunk = new SquareChunk(-2, 10000);

            starter = new PortalChunk(-1, 230, linkedDungeon, vector);
            if (!GetType().Equals(typeof(PresetDungeon)))
                generateDungeon();
        }
예제 #3
0
        //Creates a New Dungeon, Generates it if it is not Preset.
        public Dungeon()
        {
            if (!deserializing)
            {
                rooms = new RoomContainer();
                random = new Random();

                starter = new SquareChunk(-1, 10000);

                //Logger.getInstance().log(SerializeThing());

                //if not preset, make it.
                if (!GetType().Equals(typeof(PresetDungeon)))
                    generateDungeon();
            }
            else
            {
                entities = new MobContainer();
                //deserializing = false;
            }
        }
예제 #4
0
        /// <summary>
        /// Generates the Dungeon by creating a random number of rooms.
        /// </summary>
        private void generateDungeon()
        {
            Room room;
            int size = random.Next(4, 10);
            int height = 230;
            int pos = 0;
            for (int i = 0; i < size; i++)
            {
                room = new Room(height, pos, this);
                height = room.getChunk(room.getSize() - 1).getHeight(); //gets height of the last room.
                pos += room.getSize(); //increases the chunk position
                rooms.Add(room);
                if (i == 0) starter.setColor(room.getColor());
            }
            ender = new SquareChunk(rooms.ElementAt(rooms.Count - 1).getSize(), 10000);
            ender.setColor(rooms.ElementAt(rooms.Count - 1).getColor());

            DungeonManager.getInstance().setCurrentDungeon(this);
        }
 public SetLootInventoryAction(Inventory inventory, Chunk chunk)
 {
     this.inventory = inventory;
     this.chunk = chunk;
 }