コード例 #1
0
ファイル: EnemyStat.cs プロジェクト: Ridzzzz/Forsaken-Depths
    void ScaleStats(float playerLevel)
    {
        if (playerLevel == 0)
        {
            Health.CopyStatValue(baseHealth);
            Speed.CopyStatValue(baseSpeed);
            Strength.CopyStatValue(baseStrength);
            Resistance.CopyStatValue(baseResistance);

            currentHealth = Health.GetValue();
        }

        else
        {
            float modifiedHealth     = baseHealth + (playerLevel * 0.5f) + playerLevel;
            float modifiedSpeed      = Mathf.Clamp(baseSpeed + (playerLevel * 0.25f), baseSpeed, 15);
            float modifiedStrength   = baseStrength + (playerLevel * 0.5f) + playerLevel;
            float modifiedResistance = baseResistance + (playerLevel * 0.5f) + playerLevel;

            Health.CopyStatValue(modifiedHealth);
            Speed.CopyStatValue(modifiedSpeed);
            Strength.CopyStatValue(modifiedStrength);
            Resistance.CopyStatValue(modifiedResistance);

            currentHealth = Health.GetValue();
        }
    }