Пример #1
0
    void OnHungerChanged(int hunger)
    {
        if (isLocalPlayer)
        {
            if (uiStatus != null)
            {
                uiStatus.UpdateHunger(hunger);
            }

            if (((float)HP / maxHP) <= ((float)hunger / maxHunger))
            {
                uiSurvivor.SetVignette(255f * (1f - Mathf.Clamp((((float)HP / maxHP - 0.2f) * 3.333f), 0f, 1f)));
            }
            else
            {
                uiSurvivor.SetVignette(255f * (1f - Mathf.Clamp((((float)hunger / maxHunger - 0.2f) * 3.333f), 0f, 1f)));
            }

            this.hunger = hunger;

            if (hunger <= 0)
            {
                _lastestDamagedObject = "Hunger";
                dead();
            }
        }
    }