コード例 #1
0
    /// <summary>
    /// 创建随机工作者角色数据  用于黄金台招人
    /// </summary>
    /// <param name="type"></param>
    /// <returns></returns>
    public static CharacterBean CreateRandomWorkerData()
    {
        CharacterBean characterData = new CharacterBean();

        characterData.baseInfo.characterId   = SystemUtil.GetUUID(SystemUtil.UUIDTypeEnum.N);
        characterData.baseInfo.characterType = (int)NpcTypeEnum.RecruitNormal;
        //设置随机名字
        characterData.baseInfo.name = RandomUtil.GetRandomGenerateChineseWord(UnityEngine.Random.Range(2, 4));
        float randomRare = UnityEngine.Random.Range(0, 1);

        //生成随机能力
        characterData.attributes.CreateRandomData(
            1, 500,
            1, 100,
            1, 10,
            1, 10,
            1, 10,
            1, 10,
            1, 10,
            1, 10);
        //随机身体数据
        characterData.body.CreateRandomBody();
        //根据性别装备服装
        GetRandomDressByLevel(0, out long randomHat, out long randomClothes, out long randomShoes);
        characterData.equips.clothesId = randomClothes;
        characterData.equips.shoesId   = randomShoes;
        //根据能力生成工资
        characterData.attributes.CreatePriceByAttributes(out long priceL, out long priceM, out long priceS);
        characterData.baseInfo.priceL = priceL;
        characterData.baseInfo.priceM = priceM;
        characterData.baseInfo.priceS = priceS;
        return(characterData);
    }
コード例 #2
0
    /// <summary>
    /// 创建随机敌人数据
    /// </summary>
    /// <param name="characterBodyManager"></param>
    /// <returns></returns>
    public static CharacterBean CreateRandomEnemyData(int baseLife, int baseAttributes, int equipLevel)
    {
        CharacterBean characterData = new CharacterBean();

        characterData.baseInfo.characterId   = SystemUtil.GetUUID(SystemUtil.UUIDTypeEnum.N);
        characterData.baseInfo.characterType = (int)NpcTypeEnum.Other;
        //设置随机名字
        characterData.baseInfo.name = RandomUtil.GetRandomGenerateChineseWord(UnityEngine.Random.Range(2, 4));

        //随机身体数据
        characterData.body.CreateRandomBody();

        //根据性别装备服装
        GetRandomDressByLevel(equipLevel, out long randomHat, out long randomClothes, out long randomShoes);
        characterData.equips.clothesId = randomClothes;
        characterData.equips.shoesId   = randomShoes;
        //生成随机能力
        characterData.attributes.CreateRandomData(
            baseLife - 50, baseLife + 50,
            0, 1,
            baseAttributes - 3, baseAttributes + 3,
            baseAttributes - 3, baseAttributes + 3,
            baseAttributes - 3, baseAttributes + 3,
            baseAttributes - 3, baseAttributes + 3,
            baseAttributes - 3, baseAttributes + 3,
            baseAttributes - 3, baseAttributes + 3);
        return(characterData);
    }
コード例 #3
0
    /// <summary>
    /// 根据重金创建随机工作者角色数据
    /// 属性生产规则:
    /// 1.总计金钱越多能力越高 最高10
    /// 2.如果有银或者金 则可能抽中稀有角色能力上限15
    /// </summary>
    /// <param name="characterBodyManager"></param>
    /// <param name="findPriceL"></param>
    /// <param name="findPriceM"></param>
    /// <param name="findPriceS"></param>
    /// <returns></returns>
    public static CharacterBean CreateRandomWorkerDataByPrice(long findPriceL, long findPriceM, long findPriceS)
    {
        CharacterBean characterData = new CharacterBean();

        //设置ID
        characterData.baseInfo.characterId = SystemUtil.GetUUID(SystemUtil.UUIDTypeEnum.N);
        //设置随机名字
        characterData.baseInfo.name = RandomUtil.GetRandomGenerateChineseWord(UnityEngine.Random.Range(2, 4));

        //生成随机能力
        long totalPoint = (findPriceS + findPriceM * 1000 + findPriceL * 10000) / 100;
        int  maxLife    = 20;
        int  minLife    = 10;

        int maxCook = 1;
        int minCook = 1;

        int maxSpeed = 1;
        int minSpeed = 1;

        int maxAccount = 1;
        int minAccount = 1;

        int maxCharm = 1;
        int minCharm = 1;

        int maxForce = 1;
        int minForce = 1;

        int maxLucky = 1;
        int minLucky = 1;
        //稀有角色
        float getRatePro = totalPoint * 0.001f + findPriceL * 0.05f + findPriceM * 0.002f;

        //抽中稀有
        if (UnityEngine.Random.Range(0f, 1f) <= getRatePro)
        {
            characterData.baseInfo.characterType = (int)NpcTypeEnum.RecruitRare;

            maxLife = 200;
            minLife = 100;

            maxCook = 15;
            minCook = 10;

            maxSpeed = 15;
            minSpeed = 10;

            maxAccount = 15;
            minAccount = 10;

            maxCharm = 15;
            minCharm = 10;

            maxForce = 15;
            minForce = 10;

            maxLucky = 15;
            minLucky = 10;
        }
        //没有抽中稀有
        else
        {
            characterData.baseInfo.characterType = (int)NpcTypeEnum.RecruitNormal;
            while (totalPoint > 0)
            {
                int type = UnityEngine.Random.Range(1, 8);
                switch (type)
                {
                case 1:
                    maxLife += 10;
                    break;

                case 2:
                    ChangeAttributes(maxCook, minCook, out maxCook, out minCook);
                    break;

                case 3:
                    ChangeAttributes(maxSpeed, minSpeed, out maxSpeed, out minSpeed);
                    break;

                case 4:
                    ChangeAttributes(maxAccount, minAccount, out maxAccount, out minAccount);
                    break;

                case 5:
                    ChangeAttributes(maxCharm, minCharm, out maxCharm, out minCharm);
                    break;

                case 6:
                    ChangeAttributes(maxForce, minForce, out maxForce, out minForce);
                    break;

                case 7:
                    ChangeAttributes(maxLucky, minLucky, out maxLucky, out minLucky);
                    break;
                }
                totalPoint--;
            }
        }
        //if (findPriceL >= 10000)
        //{
        //    maxLife = 200;
        //    minLife = 200;

        //    maxCook = 15;
        //    minCook = 15;

        //    maxSpeed = 15;
        //    minSpeed = 15;

        //    maxAccount = 15;
        //    minAccount = 15;

        //    maxCharm = 15;
        //    minCharm = 15;

        //    maxForce = 15;
        //    minForce = 15;

        //    maxLucky = 15;
        //    minLucky = 15;
        //}

        //生成随机能力
        characterData.attributes.CreateRandomData(
            minLife, maxLife,
            50, 100,
            minCook, maxCook,
            minSpeed, maxSpeed,
            minAccount, maxAccount,
            minCharm, maxCharm,
            minForce, maxForce,
            minLucky, maxLucky);
        //随机身体数据
        characterData.body.CreateRandomBody();
        //根据性别装备服装
        if (characterData.body.sex == 1)
        {
            characterData.equips.clothesId = 210039;
        }
        else if (characterData.body.sex == 2)
        {
            characterData.equips.clothesId = 210040;
        }
        characterData.equips.shoesId = 310039;
        //根据能力生成工资
        characterData.attributes.CreatePriceByAttributes(out long priceL, out long priceM, out long priceS);
        characterData.baseInfo.priceL = priceL;
        characterData.baseInfo.priceM = priceM;
        characterData.baseInfo.priceS = priceS;
        return(characterData);
    }