예제 #1
0
파일: Level.cs 프로젝트: twobob/CSRogue
        protected virtual void DistributeCreatures()
        {
            // Get the creatures allowable on this level
            List <ItemInfo> creatureInfoList = ItemInfo.CreatureListForLevel(Depth);

            // Get the sum of their rarities
            int sumOfRarities = creatureInfoList.Sum(creatureItemInfo => creatureItemInfo.CreatureInfo.Rarity);

            // Are there no monsters allowed on this level?
            if (sumOfRarities == 0)
            {
                return;
            }

            // Figure out how many monsters on this level
            int creatureCount = CreatureCount();

            // For each creature
            for (int iCreature = 0; iCreature < creatureCount; iCreature++)
            {
                // Select a creature
                Creature creature = SelectCreature(creatureInfoList, sumOfRarities);

                // Place the selected creature
                PlaceCreature(creature);
            }
        }