//Reset stats and inventory
    public void ResetStats()
    {
        EngineHealth = 500;
        currentSpeed = 0f;

        equipmentPanel.RemoveAll();

        FrontBumperArmor.RemoveAllModifiersFromSource(FrontBumperArmor);
        RearBumperArmor.RemoveAllModifiersFromSource(RearBumperArmor);
        RightFlankArmor.RemoveAllModifiersFromSource(RightFlankArmor);
        LeftFlankArmor.RemoveAllModifiersFromSource(LeftFlankArmor);
        Maneuverability.RemoveAllModifiersFromSource(Maneuverability);
        MaximumSpeed.RemoveAllModifiersFromSource(MaximumSpeed);
        WheelArmor.RemoveAllModifiersFromSource(WheelArmor);
        TiresArmor.RemoveAllModifiersFromSource(TiresArmor);
        AccelerationSpeed.RemoveAllModifiersFromSource(AccelerationSpeed);
        DecelerationSpeed.RemoveAllModifiersFromSource(DecelerationSpeed);

        inventory.Clear();
    }
Beispiel #2
0
    private void StatBuffsTick()
    {
        //Loop through all of the buffs in reverse
        for (int i = statBuffs.Count - 1; i >= 0; i--)
        {
            //Reduce the duration of the stat buff overtime
            statBuffs[i].Duration -= Time.deltaTime;

            //If the duration is less than or equal to 0
            if (statBuffs[i].Duration <= 0)
            {
                //Check the stat type of the buff
                switch (statBuffs[i].StatType)
                {
                case StatType.MaxHealth:
                    //Remove all modifiers from this buff
                    maxHealth.RemoveAllModifiersFromSource(statBuffs[i]);

                    //Remove the buff from the list
                    statBuffs.Remove(statBuffs[i]);

                    //adjust the max health in the ui
                    setMaxHealthEvent.Raise((int)maxHealth.Value);

                    //If the player's current health is higher than the max health
                    if (health > maxHealth.Value)
                    {
                        //Clamp the current health to the max health value
                        health = Mathf.Clamp(health, 0, (int)maxHealth.Value);

                        //Update the health ui
                        setHealthEvent.Raise(health);
                    }
                    break;

                case StatType.MaxMana:
                    //Remove all modifiers from this buff
                    maxMana.RemoveAllModifiersFromSource(statBuffs[i]);

                    //Remove the buff from the list
                    statBuffs.Remove(statBuffs[i]);

                    //adjust the max health in the ui
                    setMaxManaEvent.Raise((int)maxMana.Value);

                    //If the player's current health is higher than the max health
                    if (mana > maxMana.Value)
                    {
                        //Clamp the current health to the max health value
                        mana = Mathf.Clamp(mana, 0, (int)maxMana.Value);

                        //Update the health ui
                        setManaEvent.Raise(mana);
                    }
                    break;

                case StatType.ManaRegen:
                    //Remove all modifiers from the stat
                    manaRegen.RemoveAllModifiersFromSource(statBuffs[i]);

                    //Remove the buff from the list
                    statBuffs.Remove(statBuffs[i]);
                    break;

                case StatType.Strength:
                    //Remove all modifiers from the stat
                    strength.RemoveAllModifiersFromSource(statBuffs[i]);

                    //Remove the buff from the list
                    statBuffs.Remove(statBuffs[i]);
                    break;

                case StatType.Speed:
                    //Remove all modifiers from the stat
                    speed.RemoveAllModifiersFromSource(statBuffs[i]);

                    //Remove the buff from the list
                    statBuffs.Remove(statBuffs[i]);
                    break;

                case StatType.Magic:
                    //Remove all modifiers from the stat
                    magic.RemoveAllModifiersFromSource(statBuffs[i]);

                    //Remove the buff from the list
                    statBuffs.Remove(statBuffs[i]);
                    break;
                }
            }
        }
    }
 public void RemoveModifier()
 {
     {
         Strength.RemoveAllModifiersFromSource(this);
     }
 }