Пример #1
0
    void ResetStat()
    {
        DSUnitStats stats = GameManager.Instance.SavablePlayerData.PlayerProgress.Stats;

        switch (statName)
        {
        case StatName.HEALTH:
            stats.Health.Value = stats.Health.MinValue;
            break;

        case StatName.ATTACK:
            stats.Attack.Value = stats.Attack.MinValue;
            break;

        case StatName.DEFENCE:
            stats.Defence.Value = stats.Defence.MinValue;
            break;

        case StatName.SPEED:
            stats.Speed.Value = stats.Speed.MinValue;
            break;

        case StatName.ACELERATION:
            stats.Aceleration.Value = stats.Aceleration.MinValue;
            break;

        case StatName.ROTATION_SPEED:
            stats.RotationSpeed.Value = stats.RotationSpeed.MinValue;
            break;
        }
        SetValues();
    }
Пример #2
0
 public PlayerProgress()
 {
     Flags     = new DSFlags();
     Score     = new DSPlayerScore();
     Stats     = new DSUnitStats();
     Skills    = new DSPlayerSkills();
     Equipment = new DSPlayerEquipment();
     Squad     = new DSPlayerSquad();
     Level     = new LevelInfo();
 }
Пример #3
0
    public static UnitStats RewriteStats(UnitStats baseStats, DSUnitStats newStats)
    {
        baseStats.health        = newStats.Health.Value;
        baseStats.attack        = newStats.Attack.Value;
        baseStats.defence       = newStats.Defence.Value;
        baseStats.speed         = newStats.Speed.Value;
        baseStats.acceleration  = newStats.Aceleration.Value;
        baseStats.rotationSpeed = newStats.RotationSpeed.Value;

        return(baseStats);
    }
Пример #4
0
    void SetValues()
    {
        DSUnitStats stats               = GameManager.Instance.SavablePlayerData.PlayerProgress.Stats;
        int         roundDig            = 0;
        string      percentFormat       = "##0.##%";
        string      addValPercevtFormat = "+##0.##%";
        string      valFormat           = "##0.##";
        string      addValFormat        = "+##0.##";

        switch (statName)
        {
        case StatName.HEALTH:
            name.text         = LocalizedStrings.health;
            stat              = stats.Health;
            currentValue.text = stat.Value.ToString(valFormat);
            roundDig          = 0;
            break;

        case StatName.ATTACK:
            name.text         = LocalizedStrings.attack;
            stat              = stats.Attack;
            currentValue.text = (stat.Value * 1).ToString(percentFormat);
            roundDig          = 2;
            addValFormat      = addValPercevtFormat;
            break;

        case StatName.DEFENCE:
            name.text         = LocalizedStrings.defence;
            stat              = stats.Defence;
            currentValue.text = (stat.Value * 1).ToString(percentFormat);
            roundDig          = 2;
            addValFormat      = addValPercevtFormat;
            break;

        case StatName.SPEED:
            name.text         = LocalizedStrings.speed;
            stat              = stats.Speed;
            currentValue.text = stat.Value.ToString(valFormat);
            roundDig          = 2;
            break;

        case StatName.ACELERATION:
            name.text         = "УСКОРЕНИЕ";
            stat              = stats.Aceleration;
            currentValue.text = stat.Value.ToString(valFormat);
            roundDig          = 2;
            break;

        case StatName.ROTATION_SPEED:
            name.text         = LocalizedStrings.rotationSpeed;
            stat              = stats.RotationSpeed;
            currentValue.text = stat.Value.ToString(valFormat);
            roundDig          = 0;
            break;
        }

        float addVal = (stat.MaxValue - stat.MinValue) / uprgadeLevelsCount;

        additionnalVal       = (float)Math.Round(addVal, roundDig);
        additionalValue.text = additionnalVal.ToString(addValFormat);

        int   currentLevel = (int)((stat.Value - stat.MinValue) / addVal);
        float x            = (float)(currentLevel) / uprgadeLevelsCount;

        if (sliderToHightestLevel != null)
        {
            sliderToHightestLevel.value = x;
        }
        if (sliderToNextLevel != null)
        {
            sliderToNextLevel.value = stat.Progress;
        }

        nextLevelCostWhenProgressZero = (int)Math.Round(Mathf.Lerp(minCost, maxCost, upgradeCost.Evaluate(x)));
        nextLevelCost = (int)Math.Round((1 - stat.Progress) * nextLevelCostWhenProgressZero);

        cost.text = nextLevelCost.ToString("# ### ##0");
    }