Esempio n. 1
0
    public void takeDAMAGE(float n, Vector3 direct)
    {
        //是否爆擊判定
        bool gritical = MathS.chancePersent(10);

        //爆擊時傷害加乘
        n = gritical ? n * 1.5f : n;

        //是否穿刺判定
        bool puncture = MathS.chancePersent(10);
        //穿刺時傷害加乘
        float p = puncture ? p = n * 0.1f : 0;

        //爆擊時跳字變色
        //爆擊黃色、穿刺紅色、同時發生橘色
        string color;

        if (gritical && puncture)
        {
            color = "ORANGE";
        }
        else
        if (gritical)
        {
            color = "YELLOW";
        }
        else
        if (puncture)
        {
            color = "RED";
        }
        else
        {
            color = "WHITE";
        }

        var r           = UnityEngine.Random.Range(0.8f, 1.2f);
        var finalDamage = (p + n - DEF) * r;

        if (finalDamage > 0)
        {
            HP -= finalDamage;
        }
        getjumpText(finalDamage, direct, color);
    }