void Update()
    {
        if (PlayerManager.LocalPlayer == null)
        {
            return;
        }

        if (humanUI && !oxygenButton.gameObject.activeInHierarchy)
        {
            EnableAlwaysVisible();
        }

        if (PlayerManager.LocalPlayerScript.IsGhost)
        {
            if (humanUI)
            {
                DisableAll();
            }
            return;
        }


        if (!PlayerManager.LocalPlayerScript.IsGhost && !humanUI)
        {
            EnableAlwaysVisible();
        }

        float temperature = PlayerManager.LocalPlayerScript.playerHealth.respiratorySystem.temperature;
        float pressure    = PlayerManager.LocalPlayerScript.playerHealth.respiratorySystem.pressure;

        if (temperature < 110)
        {
            SetSpecificVisibility(true, coldAlert);
        }
        else
        {
            SetSpecificVisibility(false, coldAlert);
        }

        if (temperature > 510)
        {
            SetSpecificVisibility(true, heatAlert);
        }
        else
        {
            SetSpecificVisibility(false, heatAlert);
        }


        if (temperature > 260 && temperature < 360)
        {
            SetSpecificVisibility(false, temperatureAlert.gameObject);
        }
        else
        {
            SetSpecificVisibility(true, temperatureAlert.gameObject);
            temperatureAlert.SetTemperatureSprite(temperature);
        }

        if (pressure > 50 && pressure < 325)
        {
            SetSpecificVisibility(false, pressureAlert.gameObject);
        }
        else
        {
            SetSpecificVisibility(true, pressureAlert.gameObject);
            pressureAlert.SetPressureSprite(pressure);
        }

        SetSpecificVisibility(PlayerManager.LocalPlayerScript.playerHealth.respiratorySystem.IsSuffocating, oxygenAlert);

        SetSpecificVisibility(false, toxinAlert);
        SetSpecificVisibility(PlayerManager.LocalPlayerScript.playerHealth.Metabolism.IsHungry, hungerAlert);

        if (PlayerManager.Equipment.HasInternalsEquipped() && !oxygenButton.IsInteractable())
        {
            oxygenButton.interactable = true;
        }

        if (!PlayerManager.Equipment.HasInternalsEquipped() && oxygenButton.IsInteractable())
        {
            EventManager.Broadcast(EVENT.DisableInternals);
            oxygenButton.interactable = false;
        }
    }
Exemple #2
0
    void Update()
    {
        if (PlayerManager.LocalPlayer == null)
        {
            return;
        }

        if (PlayerManager.LocalPlayerScript.IsGhost)
        {
            if (humanUI)
            {
                DisableAll();
            }
            return;
        }


        if (!PlayerManager.LocalPlayerScript.IsGhost && !humanUI)
        {
            EnableAlwaysVisible();
        }

        float temperature = PlayerManager.LocalPlayerScript.playerHealth.respiratorySystem.temperature;
        float pressure    = PlayerManager.LocalPlayerScript.playerHealth.respiratorySystem.pressure;

        if (temperature < 110)
        {
            SetSpecificVisibility(true, coldAlert);
        }
        else
        {
            SetSpecificVisibility(false, coldAlert);
        }

        if (temperature > 510)
        {
            SetSpecificVisibility(true, heatAlert);
        }
        else
        {
            SetSpecificVisibility(false, heatAlert);
        }


        if (temperature > 260 && temperature < 360)
        {
            SetSpecificVisibility(false, temperatureAlert.gameObject);
        }
        else
        {
            SetSpecificVisibility(true, temperatureAlert.gameObject);
            temperatureAlert.SetTemperatureSprite(temperature);
        }

        if (pressure > 50 && pressure < 325)
        {
            SetSpecificVisibility(false, pressureAlert.gameObject);
        }
        else
        {
            SetSpecificVisibility(true, pressureAlert.gameObject);
            pressureAlert.SetPressureSprite(pressure);
        }

        SetSpecificVisibility(PlayerManager.LocalPlayerScript.playerHealth.respiratorySystem.IsSuffocating, oxygenAlert);

        SetSpecificVisibility(false, toxinAlert);
        SetSpecificVisibility(PlayerManager.LocalPlayerScript.playerHealth.Metabolism.IsHungry, hungerAlert);
    }
    void UpdateMe()
    {
        if (PlayerManager.LocalPlayer == null)
        {
            return;
        }

        if (PlayerManager.LocalPlayerScript.IsGhost)
        {
            if (humanUI)
            {
                DisableAll();
            }
            return;
        }


        if (!PlayerManager.LocalPlayerScript.IsGhost && !humanUI)
        {
            EnableAlwaysVisible();
        }

        float temperature = PlayerManager.LocalPlayerScript.playerHealth.RespiratorySystem.Temperature;
        float pressure    = PlayerManager.LocalPlayerScript.playerHealth.RespiratorySystem.Pressure;

        if (temperature < 110)
        {
            SetSpecificVisibility(true, coldAlert);
        }
        else
        {
            SetSpecificVisibility(false, coldAlert);
        }

        if (temperature > 510)
        {
            SetSpecificVisibility(true, heatAlert);
        }
        else
        {
            SetSpecificVisibility(false, heatAlert);
        }


        if (temperature > 260 && temperature < 360)
        {
            SetSpecificVisibility(false, temperatureAlert.gameObject);
        }
        else
        {
            SetSpecificVisibility(true, temperatureAlert.gameObject);
            temperatureAlert.SetTemperatureSprite(temperature);
        }

        if (pressure > 50 && pressure < 325)
        {
            SetSpecificVisibility(false, pressureAlert.gameObject);
        }
        else
        {
            SetSpecificVisibility(true, pressureAlert.gameObject);
            pressureAlert.SetPressureSprite(pressure);
        }

        SetSpecificVisibility(PlayerManager.LocalPlayerScript.playerHealth.RespiratorySystem.IsSuffocating, oxygenAlert);

        SetSpecificVisibility(false, toxinAlert);

        switch (PlayerManager.LocalPlayerScript.playerHealth.HealthStateController.HungerState)
        {
        case HungerState.Full:
            hungerAlert.gameObject.SetActive(true);
            hungerAlert.ChangeSprite(0);
            break;

        case HungerState.Normal:
            hungerAlert.gameObject.SetActive(false);
            hungerAlert.PushClear();
            break;

        case HungerState.Hungry:
            hungerAlert.gameObject.SetActive(true);
            hungerAlert.ChangeSprite(1);
            break;

        case HungerState.Malnourished:
            hungerAlert.gameObject.SetActive(true);
            hungerAlert.ChangeSprite(1);
            break;

        case HungerState.Starving:
            hungerAlert.gameObject.SetActive(true);
            hungerAlert.ChangeSprite(2);
            break;

        default:
            hungerAlert.gameObject.SetActive(false);
            hungerAlert.PushClear();
            break;
        }

        switch (PlayerManager.LocalPlayerScript.playerHealth.HealthStateController.BleedingState)
        {
        case BleedingState.None:
            bleedingAlert.gameObject.SetActive(false);
            bleedingAlert.PushClear();
            break;

        case BleedingState.VeryLow:
            bleedingAlert.gameObject.SetActive(true);
            bleedingAlert.ChangeSprite(0);
            break;

        case BleedingState.Low:
            bleedingAlert.gameObject.SetActive(true);
            bleedingAlert.ChangeSprite(1);
            break;

        case BleedingState.Medium:
            bleedingAlert.gameObject.SetActive(true);
            bleedingAlert.ChangeSprite(2);
            break;

        case BleedingState.High:
            bleedingAlert.gameObject.SetActive(true);
            bleedingAlert.ChangeSprite(3);
            break;

        case BleedingState.UhOh:
            bleedingAlert.gameObject.SetActive(true);
            bleedingAlert.ChangeSprite(4);
            break;

        default:
            bleedingAlert.gameObject.SetActive(false);
            bleedingAlert.PushClear();
            break;
        }


        // if (!PlayerManager.Equipment.HasInternalsEquipped() && oxygenButton.IsInteractable())
        // {
        // EventManager.Broadcast(EVENT.DisableInternals);
        // oxygenButton.interactable = false;
        // }
    }