Пример #1
0
    // Update is called once per frame
    void Update()
    {
        if (stackedFood >= 5f)
        {
            stackedFood = 0f;
            currentFood.m_variable.Value -= 5f;
            updateEvent.Raise();

            if (currentFood.Value < 0)
            {
                currentFood.m_variable.Value = 0;
            }
        }

        if (currentFood.Value > 0f)
        {
            stackedFood += (baseFoodLost * Time.deltaTime);
        }
        else
        {
            if (lastHit + STARVATION_THICK_DELAY <= Time.time)
            {
                lastHit = Time.time;
                unitHealth.Starvation(maxHealth.Value * lostHealthPerSecond);
            }
        }
    }