示例#1
0
        public void SetTier(MonsterTier tier)
        {
            switch (tier)
            {
            case MonsterTier.Common:
                Common.SetActive(true);
                break;

            case MonsterTier.Uncommon:
                Uncommon.SetActive(true);
                break;

            case MonsterTier.Rare:
                Rare.SetActive(true);
                break;

            case MonsterTier.Legendary:
                Legendary.SetActive(true);
                break;

            default:
                Common.SetActive(true);
                break;
            }
        }
示例#2
0
        private static void GenerateTierAndHP(out int hp, out MonsterTier tier)
        {
            var tierRandom = Random.value;

            if (tierRandom <= 0.5f)
            {
                tier = MonsterTier.Common;
            }
            else if (tierRandom <= 0.8f)
            {
                tier = MonsterTier.Uncommon;
            }
            else if (tierRandom <= 0.95f)
            {
                tier = MonsterTier.Rare;
            }
            else
            {
                tier = MonsterTier.Legendary;
            }

            switch (tier)
            {
            case MonsterTier.Common:
                hp = Random.Range(9, 14);
                break;

            case MonsterTier.Uncommon:
                hp = Random.Range(13, 18);
                break;

            case MonsterTier.Rare:
                hp = Random.Range(17, 23);
                break;

            case MonsterTier.Legendary:
                hp = Random.Range(22, 31);
                break;

            default:
                hp = 10;
                break;
            }
        }
示例#3
0
    public BaseMonsterScriptableObject GetMonster(int currentTurn)
    {
        MonsterTier monsterTier = null;

        char[] c;

        foreach (var mt in MonsterTierList)         // ? = number
        {
            switch (mt.TierType)
            {
            case TierType.Between:                     // ?-?
                c = mt.StringFormatTier.ToCharArray();
                for (int i = int.Parse(c[0].ToString()); i <= int.Parse(c[2].ToString()); i++)
                {
                    if (i == currentTurn)
                    {
                        monsterTier = mt;
                    }
                }
                break;

            case TierType.MoreThen:                     // ?+
                c = mt.StringFormatTier.ToCharArray();
                if (currentTurn >= int.Parse(c[0].ToString()))
                {
                    monsterTier = mt;
                }
                break;

            case TierType.Extra:                     // ?%
                c = mt.StringFormatTier.ToCharArray();
                int randomValue = Random.Range(1, 101);
                if (int.Parse(c[0].ToString()) >= randomValue)
                {
                    int index = Random.Range(0, mt.Monsters.Count);
                    return(mt.Monsters[index]);
                }
                break;
            }
        }

        return(monsterTier.Monsters[Random.Range(0, monsterTier.Monsters.Count)]);
    }