Exemplo n.º 1
0
    IEnumerator MakeCustomerNormalCoroutine()
    {
//        yield return new WaitForSeconds(1.0f);//遅延時間

        int GameLv = StatGame.GetComponent <StatGame>().StatLv;

        string SelectedId;
        int    SelectedIdInt;
        string SelectedName;
        string SelectedImage;
        string SelectedHp;
        float  SelectedHpFloat;
        int    SelectedHpInt;
        string SelectedCoreColor;
        string SelectedColor;
        string SelectedDropG;
        int    SelectedDropGInt;
        float  SelectedDropGFloat;
        string SelectedDropName;
        string SelectedDropImage;
        string SelectedDropPower;
        float  SelectedDropPowerFloat;
        int    SelectedDropPowerInt;
        string SelectedDropColor;
        string SelectedDropSus;
        float  SelectedDropSusFloat;
        int    SelectedDropSusInt;
        string SelectedMeatName;
        string SelectedMeatImage;
        string SelectedMeatPower;
        float  SelectedMeatPowerFloat;
        int    SelectedMeatPowerInt;
        string SelectedMeatColor;
        string SelectedMeatSus;
        float  SelectedMeatSusFloat;
        int    SelectedMeatSusInt;
        string SelectedSaveSus;
        int    SelectedSaveSusInt;
        string SelectedRare;
        string SelectedPopLv;
        int    SelectedPopLvInt;
        string SelectedDisLv;
        int    SelectedDisLvInt;
        float  RandomTop    = 1.2f; //ランダム上限
        float  RandomBottom = 0.8f; //ランダム下限


        int count = 0;

        //そのレアリティの客がそのレベル帯にいない場合、別のレアリティのを入れる。
        //※代替レアリティの客が存在する保証はプログラム内にはない → どのレベル帯にも最低CとUCはいるようにする

        if (CustomerNum > 20)
        {
            Debug.Log("20人いるので20人にします"); CustomerNum = 20;
        }
        while (count < CustomerNum)
        {
            string[,] UseCustomer;
            string ThisRarerity = GetRarerity();

            if (ThisRarerity == "C")
            {
                if (StatGame.GetComponent <StatGame>().CustmerC[0, 0] == "None")
                {
                    UseCustomer = StatGame.GetComponent <StatGame>().CustmerUC;
                    Debug.Log("CがいないのでUCにしました");
                }
                else
                {
                    UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
                }
            }
            else if (ThisRarerity == "UC")
            {
                if (StatGame.GetComponent <StatGame>().CustmerUC[0, 0] == "None")
                {
                    UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
                    Debug.Log("UCがいないのでCにしました");
                }
                else
                {
                    UseCustomer = StatGame.GetComponent <StatGame>().CustmerUC;
                }
            }
            else if (ThisRarerity == "R")
            {
                if (StatGame.GetComponent <StatGame>().CustmerR[0, 0] == "None")
                {
                    UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
                    Debug.Log("RがいないのでCにしました");
                }
                else
                {
                    UseCustomer = StatGame.GetComponent <StatGame>().CustmerR;
                }
            }
            else if (ThisRarerity == "SUS")
            {
                if (StatGame.GetComponent <StatGame>().CustmerSus[0, 0] == "None")
                {
                    UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
                    Debug.Log("SUSがいないのでCにしました");
                }
                else
                {
                    UseCustomer = StatGame.GetComponent <StatGame>().CustmerSus;
                }
            }
            else
            {
                UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
                Debug.Log("レアリティが変です。Cにしました");
            }

            int CustomerLength = UseCustomer.GetLength(0);
            int RandomCount    = Random.Range(0, CustomerLength - 1);


            SelectedId         = UseCustomer[RandomCount, LowId];
            SelectedIdInt      = int.Parse(SelectedId);
            SelectedName       = UseCustomer[RandomCount, LowName];
            SelectedImage      = UseCustomer[RandomCount, LowImage];
            SelectedHp         = UseCustomer[RandomCount, LowHp];
            SelectedCoreColor  = UseCustomer[RandomCount, LowCoreColor];
            SelectedColor      = "";
            SelectedDropG      = UseCustomer[RandomCount, LowDropG];
            SelectedDropName   = UseCustomer[RandomCount, LowDropName];
            SelectedDropImage  = UseCustomer[RandomCount, LowDropImage];
            SelectedDropPower  = UseCustomer[RandomCount, LowDropPower];
            SelectedDropColor  = "";
            SelectedDropSus    = UseCustomer[RandomCount, LowDropSus];
            SelectedMeatName   = UseCustomer[RandomCount, LowMeatName];
            SelectedMeatImage  = UseCustomer[RandomCount, LowMeatImage];
            SelectedMeatPower  = UseCustomer[RandomCount, LowMeatPower];
            SelectedMeatColor  = "";
            SelectedMeatSus    = UseCustomer[RandomCount, LowMeatSus];
            SelectedSaveSus    = UseCustomer[RandomCount, LowSaveSus];
            SelectedSaveSusInt = int.Parse(SelectedSaveSus);
            SelectedRare       = UseCustomer[RandomCount, LowRare];
            SelectedPopLv      = UseCustomer[RandomCount, LowPopLv];
            SelectedPopLvInt   = int.Parse(SelectedPopLv);
            SelectedDisLv      = UseCustomer[RandomCount, LowDisLv];
            SelectedDisLvInt   = int.Parse(SelectedDisLv);



            //Hp,G,Power,Susのランダム化
            //パワー、SUS99以上は99にする
            SelectedHpFloat = float.Parse(SelectedHp);
            SelectedHpFloat = Random.Range(SelectedHpFloat * RandomBottom, SelectedHpFloat * RandomTop);
            SelectedHpInt   = Mathf.RoundToInt(SelectedHpFloat);

            SelectedDropGFloat = float.Parse(SelectedDropG);
            SelectedDropGFloat = Random.Range(SelectedDropGFloat * RandomBottom, SelectedDropGFloat * RandomTop);
            SelectedDropGInt   = Mathf.RoundToInt(SelectedDropGFloat);

            SelectedMeatPowerFloat = float.Parse(SelectedMeatPower);
            SelectedMeatPowerFloat = Random.Range(SelectedMeatPowerFloat * RandomBottom, SelectedMeatPowerFloat * RandomTop);
            SelectedMeatPowerInt   = Mathf.RoundToInt(SelectedMeatPowerFloat);
            if (SelectedMeatPowerInt > 99)
            {
                SelectedMeatPowerInt = 99;
            }
            SelectedMeatPower = SelectedMeatPowerInt.ToString();

            SelectedMeatSusFloat = float.Parse(SelectedMeatSus);
            SelectedMeatSusFloat = Random.Range(SelectedMeatSusFloat * RandomBottom, SelectedMeatSusFloat * RandomTop);
            SelectedMeatSusInt   = Mathf.RoundToInt(SelectedMeatSusFloat);
            if (SelectedMeatSusInt > 99)
            {
                SelectedMeatSusInt = 99;
            }
            SelectedMeatSus = SelectedMeatSusInt.ToString();

            SelectedDropPowerFloat = float.Parse(SelectedDropPower);
            SelectedDropPowerFloat = Random.Range(SelectedDropPowerFloat * RandomBottom, SelectedDropPowerFloat * RandomTop);
            SelectedDropPowerInt   = Mathf.RoundToInt(SelectedDropPowerFloat);
            if (SelectedDropPowerInt > 99)
            {
                SelectedDropPowerInt = 99;
            }
            SelectedDropPower = SelectedDropPowerInt.ToString();

            SelectedDropSusFloat = float.Parse(SelectedDropSus);
            SelectedDropSusFloat = Random.Range(SelectedDropSusFloat * RandomBottom, SelectedDropSusFloat * RandomTop);
            SelectedDropSusInt   = Mathf.RoundToInt(SelectedDropSusFloat);
            if (SelectedDropSusInt > 99)
            {
                SelectedDropSusInt = 99;
            }
            SelectedDropSus = SelectedDropSusInt.ToString();



            GetComponent <CustomerController>().MakeCustomer(
                SelectedIdInt,
                SelectedName,
                SelectedImage,
                SelectedHpInt,
                SelectedCoreColor,
                SelectedColor,
                SelectedDropGInt,
                new string[] { SelectedDropName, SelectedDropImage, SelectedDropPower, SelectedDropColor, SelectedDropSus },
                new string[] { SelectedMeatName, SelectedMeatImage, SelectedMeatPower, SelectedMeatColor, SelectedMeatSus },
                SelectedSaveSusInt,
                SelectedRare,
                SelectedPopLvInt,
                SelectedDisLvInt,
                0);
            yield return(new WaitForSeconds(0.1f));//遅延時間

            count++;
        }
        yield return(null);
    }
Exemplo n.º 2
0
    //Market用のアイテム生成
    //そのレベル帯の客から、指定されたレアリティからランダムで1体選び、dropItemかMeatItemを返す
    //ItemType=0 drop =1 meat
    public string[] GetMarketItem(int ItemType, string Rarerity)
    {
        string[] ReturnItem = { "Name", "PictuePath", "Power", "Color", "Sus" };
        int      GameLv     = StatGame.GetComponent <StatGame>().StatLv;

        string SelectedDropName;
        string SelectedDropImage;
        string SelectedDropPower;
        string SelectedDropSus;
        string SelectedMeatName;
        string SelectedMeatImage;
        string SelectedMeatPower;
        string SelectedMeatSus;

        string SelectedCoreColor;

        string[,] UseCustomer;
        string ThisRarerity = Rarerity;

        if (ThisRarerity == "C")
        {
            if (StatGame.GetComponent <StatGame>().CustmerC[0, 0] == "None")
            {
                UseCustomer = StatGame.GetComponent <StatGame>().CustmerUC;
                Debug.Log("CがいないのでUCにしました");
            }
            else
            {
                UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
            }
        }
        else if (ThisRarerity == "UC")
        {
            if (StatGame.GetComponent <StatGame>().CustmerUC[0, 0] == "None")
            {
                UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
                Debug.Log("UCがいないのでCにしました");
            }
            else
            {
                UseCustomer = StatGame.GetComponent <StatGame>().CustmerUC;
            }
        }
        else if (ThisRarerity == "R")
        {
            if (StatGame.GetComponent <StatGame>().CustmerR[0, 0] == "None")
            {
                UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
                Debug.Log("RがいないのでCにしました");
            }
            else
            {
                UseCustomer = StatGame.GetComponent <StatGame>().CustmerR;
            }
        }
        else if (ThisRarerity == "SUS")
        {
            if (StatGame.GetComponent <StatGame>().CustmerSus[0, 0] == "None")
            {
                UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
                Debug.Log("SUSがいないのでCにしました");
            }
            else
            {
                UseCustomer = StatGame.GetComponent <StatGame>().CustmerSus;
            }
        }
        else
        {
            UseCustomer = StatGame.GetComponent <StatGame>().CustmerC;
            Debug.Log("レアリティが変です。Cにしました");
        }


        int CustomerLength = UseCustomer.GetLength(0);
        int RandomCount    = Random.Range(0, CustomerLength - 1);

        SelectedDropName  = UseCustomer[RandomCount, LowDropName];
        SelectedDropImage = UseCustomer[RandomCount, LowDropImage];
        SelectedDropPower = UseCustomer[RandomCount, LowDropPower];
        SelectedDropSus   = UseCustomer[RandomCount, LowDropSus];
        SelectedMeatName  = UseCustomer[RandomCount, LowMeatName];
        SelectedMeatImage = UseCustomer[RandomCount, LowMeatImage];
        SelectedMeatPower = UseCustomer[RandomCount, LowMeatPower];
        SelectedMeatSus   = UseCustomer[RandomCount, LowMeatSus];

        //        SelectedCoreColor = UseCustomer[RandomCount, LowCoreColor];
        //colorはランダム

        //色のゆれ
        float PlusR  = Random.Range(50f / 255, 200f / 255);
        float PlusG  = Random.Range(50f / 255, 200f / 255);
        float PlusB  = Random.Range(50f / 255, 200f / 255);
        Color UseCol = new Color(PlusR, PlusG, PlusB, 1f);

        SelectedCoreColor = "#" + GetComponent <ColorGetter>().ToColorString(UseCol);


        if (ItemType == 0)
        {
            ReturnItem[3] = SelectedCoreColor;

            ReturnItem[0] = SelectedDropName;
            ReturnItem[1] = SelectedDropImage;
            ReturnItem[2] = SelectedDropPower;
            ReturnItem[4] = SelectedDropSus;
        }
        else
        {
            ReturnItem[3] = SelectedCoreColor;

            ReturnItem[0] = SelectedMeatName;
            ReturnItem[1] = SelectedMeatImage;
            ReturnItem[2] = SelectedMeatPower;
            ReturnItem[4] = SelectedMeatSus;
        }

        return(ReturnItem);
    }