コード例 #1
0
ファイル: Generator.cs プロジェクト: jnobleza/cartographyte
        private Generator()
        {
            roomList         = new List <Room>();
            monsterGenerator = new MonsterGenList();

            GenerationData data = GenerationData.getInstance();

            availableSquares = data.gridSquares;

            weightedMin = 4;
            weightedMax = availableSquares / 2;
        }
コード例 #2
0
ファイル: Generator.cs プロジェクト: jnobleza/cartographyte
        private void GenerateMonsters()
        {
            GenerationData data = GenerationData.getInstance();
            int            monsterCount = 0, monsterLikelyness = 0;

            monsterGenerator = new MonsterGenList();

            // Determine what monster mode we are using and set the variables to act as such
            switch (data.monsterMode)
            {
            case MonsterMode.None:
                monsterCount = monsterLikelyness = 0;
                break;

            case MonsterMode.Few:
                monsterCount      = 5;
                monsterLikelyness = 21;
                break;

            case MonsterMode.Moderate:
                monsterCount      = 10;
                monsterLikelyness = 31;
                break;

            case MonsterMode.Many:
                monsterCount      = 20;
                monsterLikelyness = 61;
                break;
            }

            //check & set level
            monsterGenerator.SetMonsterStats(data.level, data.level + 5);

            for (int i = 0; i < roomList.Count; i++)
            {
                // Needs randomized x coord?
                monsterGenerator.SetMonsterRoomDimensions(roomList[i].posX, roomList[i].posY, roomList[i].width, roomList[i].height);

                //set monsters
                //everything is minions for now
                for (int j = 0; j < monsterCount; j++)
                {
                    int currRand = rndTwo.Next(1, 101);
                    if (currRand < monsterLikelyness)
                    {
                        roomList[i].addToMonsList(monsterGenerator.GenerateMinion());
                    }
                }
            }
        }
コード例 #3
0
        // Generation Button, does the magic
        private void generateButton_Click(object sender, EventArgs e)
        {
            // Get the data instance
            GenerationData data = GenerationData.getInstance();

            // Pass in the data
            data.setupData(levelBox.SelectedIndex + 1, roomsBox.SelectedIndex + 1,
                           (TrapMode)trapBox.SelectedIndex, (MonsterMode)monstersBox.SelectedIndex,
                           (DifficultyLevel)difficultyBox.SelectedIndex, (TreasureMode)treasureBox.SelectedIndex);

            // TODO: Run the Generation
            Generator generator = Generator.getInstance();

            generator.GenerateRooms();

            LevelData.getInstance().setupLevelWithData(generator.roomList);
        }
コード例 #4
0
ファイル: Generator.cs プロジェクト: jnobleza/cartographyte
        public void GenerateRooms()
        {
            roomList.Clear();
            GenerationData data = GenerationData.getInstance();

            availableSquares = data.gridSquares;

            //check # rooms
            //go through each and make a new room
            while (roomList.Count < data.numberOfRooms)
            {
                GenerateRoom();
            }

            // Add the Monsters to the Room
            GenerateMonsters();
        }
コード例 #5
0
ファイル: Generator.cs プロジェクト: jnobleza/cartographyte
 public void clearWeights()
 {
     weightedMin = 4;
     weightedMax = GenerationData.getInstance().gridSquares / 2;
 }