コード例 #1
0
    //Tool functions
    private float GetRatioMultiByStat(ERatioStat Stat)
    {
        switch (Stat)
        {
        case ERatioStat.Bad:
            return(multiWhenBad);

        case ERatioStat.Normal:
            return(multiWhenNormal);

        case ERatioStat.Good:
            return(multiWhenGood);

        case ERatioStat.Perfect:
            return(multiWhenPerfect);
        }
        return(1.0f);
    }
コード例 #2
0
    public void SwitchSprite(ERatioStat stat)
    {
        switch (stat)
        {
        case ERatioStat.Bad:
            img.sprite = badSprite;
            break;

        case ERatioStat.Normal:
            img.sprite = normalSprite;
            break;

        case ERatioStat.Good:
            img.sprite = goodSprite;
            break;

        case ERatioStat.Perfect:
            img.sprite = perfectSprite;
            break;
        }
    }
コード例 #3
0
    void CheckRatio()
    {
        switch (gameOpenedType)
        {
        case 1:
            CurRatio = ERatioStat.Perfect;
            break;

        case 2:
            if (tankCount <= 0)
            {
                CurRatio = ERatioStat.Bad;
            }
            else
            {
                float soldierBase    = tankCount * (perfectStoJ / perfectTtoJ);
                float curSoldierPara = Mathf.Abs(soldierCount - soldierBase) / soldierBase;
                if (curSoldierPara > normalRatioPara * tankCount)
                {
                    CurRatio = ERatioStat.Bad;
                }
                else if (curSoldierPara <= normalRatioPara && curSoldierPara > goodRatioPara)
                {
                    CurRatio = ERatioStat.Normal;
                }
                else if (curSoldierPara <= goodRatioPara && curSoldierPara > 0)
                {
                    CurRatio = ERatioStat.Good;
                }
                else
                {
                    CurRatio = ERatioStat.Perfect;
                }
            }
            break;

        case 3:
            if (jetCount <= 0)
            {
                CurRatio = ERatioStat.Bad;
            }
            else
            {
                int   soldierBase = jetCount * perfectStoJ;
                int   tankBase    = jetCount * perfectTtoJ;
                float curSumPara  = (Mathf.Abs(soldierBase - soldierCount) / soldierBase) + (Mathf.Abs(tankBase - tankCount) / tankBase);
                if (curSumPara > normalRatioPara)
                {
                    CurRatio = ERatioStat.Bad;
                }
                else if (curSumPara <= normalRatioPara && curSumPara > goodRatioPara)
                {
                    CurRatio = ERatioStat.Normal;
                }
                else if (curSumPara <= goodRatioPara && curSumPara > 0)
                {
                    CurRatio = ERatioStat.Good;
                }
                else
                {
                    CurRatio = ERatioStat.Perfect;
                }
            }

            break;
        }

        Debug.Log(CurRatio + "Jet: " + jetCount + ", Tank: " + tankCount + ", Soldier: " + soldierCount);
        UpdateRatioUI();
    }