コード例 #1
0
    public static Dungeon GenerateDungeon()
    {
        Dungeon toReturn;

        float rnd  = Random.Range(1, 100);
        float rnd2 = Random.Range(1, 100);
        float rnd3 = Random.Range(1, 100);

        float total = rnd + rnd2 + rnd3;

        float dStrengthWeight     = rnd / total;
        float dIntelligenceWeight = rnd2 / total;
        float dAgilityWeight      = rnd3 / total;

        int dDifficultyRating = Random.Range(1, 21);

        string dName = GenerateDungeonName(dDifficultyRating);

        // 1800
        int dTime = 1800 * dDifficultyRating;

        Quest.QuestRewardType dRewardType = (Quest.QuestRewardType)Random.Range(0, System.Enum.GetNames(typeof(Quest.QuestRewardType)).Length);
        int dRewardAmount = 100 + (dDifficultyRating * 25 * Quest.getRewardTypeConversionRate(dRewardType));

        dDifficultyRating *= 125;

        toReturn = new Dungeon(
            dName,
            dStrengthWeight,
            dIntelligenceWeight,
            dAgilityWeight,
            dTime,
            dRewardType,
            dRewardAmount,
            dDifficultyRating
            );

        return(toReturn);
    }
コード例 #2
0
    public Dungeon(
        string name,
        float strengthWeight,
        float intelligenceWeight,
        float agilityWeight,
        int time,
        Quest.QuestRewardType rewardType,
        int rewardAmount,
        int difficultyRating
        )
    {
        this.name               = name;
        this.strengthWeight     = strengthWeight;
        this.intelligenceWeight = intelligenceWeight;
        this.agilityWeight      = agilityWeight;
        this.time               = time;

        this.rewardType   = rewardType;
        this.rewardAmount = rewardAmount;

        this.difficultyRating = difficultyRating;
    }