Beispiel #1
0
    protected virtual float IncrementEnergy(float increment)
    {
        if (increment < 0)
        {
            increment = -Mathf.Min(-increment, Energy);
        }
        else
        {
            increment = Mathf.Min(increment, BaseEnergy - Energy);
        }

        Energy = Energy + increment;
        CurrentWorld.FoodEnergyChange(increment);

        if (Energy > 0)
        {
            AdaptScale();
        }
        else if (DestroyWhenEmpty)
        {
            CurrentWorld.FoodDestroyed(this);
            Destroy();
        }

        return(increment);
    }