示例#1
0
    // --------------------
    // UPDATES FROM SERVER
    // --------------------

    /// <summary>
    /// Updated from server via NetMsg
    /// </summary>

    public void UpdateClientGauges(UI_PressureAlert.PressureChecker pressureStatus, UI_TempAlert.TempChecker tempStatus)
    {
        if (CustomNetworkManager.IsServer)
        {
            return;
        }
        PressureStatus = pressureStatus;
        TempStatus     = tempStatus;
    }
示例#2
0
 void CheckOverallHealth()
 {
     if (overallHealthCache != livingHealthBehaviour.OverallHealth ||
         consciousStateCache != livingHealthBehaviour.ConsciousState ||
         pressureStatusCache != livingHealthBehaviour.PressureStatus ||
         tempStatusCache != livingHealthBehaviour.TempStatus)
     {
         overallHealthCache  = livingHealthBehaviour.OverallHealth;
         consciousStateCache = livingHealthBehaviour.ConsciousState;
         pressureStatusCache = livingHealthBehaviour.PressureStatus;
         tempStatusCache     = livingHealthBehaviour.TempStatus;
         SendOverallUpdate();
     }
 }
示例#3
0
 void InitServerCache()
 {
     overallHealthCache  = livingHealthBehaviour.OverallHealth;
     consciousStateCache = livingHealthBehaviour.ConsciousState;
     isBreathingCache    = livingHealthBehaviour.respiratorySystem.IsBreathing;
     isSuffocatingCache  = livingHealthBehaviour.respiratorySystem.IsSuffocating;
     pressureStatusCache = livingHealthBehaviour.PressureStatus;
     tempStatusCache     = livingHealthBehaviour.TempStatus;
     UpdateBloodCaches();
     if (livingHealthBehaviour.brainSystem != null)
     {
         isHuskCache      = livingHealthBehaviour.brainSystem.IsHuskServer;
         brainDamageCache = livingHealthBehaviour.brainSystem.BrainDamageAmt;
     }
     init = true;
 }
    public static HealthOverallMessage SendToAll(GameObject entityToUpdate, int overallHealth, ConsciousState consciousState, UI_PressureAlert.PressureChecker pressureStatus, UI_TempAlert.TempChecker tempStatus)
    {
        HealthOverallMessage msg = new HealthOverallMessage
        {
            EntityToUpdate = entityToUpdate.GetComponent <NetworkIdentity>().netId,
            OverallHealth  = overallHealth,
            ConsciousState = consciousState,
            PressureStatus = pressureStatus,
            TempStatus     = tempStatus,
        };

        msg.SendToAll();
        return(msg);
    }
示例#5
0
    void UpdateMe()
    {           //Doesn't update if player doesn't exist
        if (PlayerManager.LocalPlayer == null)
        {
            return;
        }
        if (PlayerManager.LocalPlayerScript.IsGhost || PlayerManager.LocalPlayerScript.playerHealth.IsDead)
        {
            if (oxygenAlert.gameObject.activeInHierarchy)
            {
                oxygenAlert.gameObject.SetActive(false);
            }
            if (tempAlert.gameObject.activeInHierarchy)
            {
                tempAlert.gameObject.SetActive(false);
            }
            if (pressureAlert.gameObject.activeInHierarchy)
            {
                pressureAlert.gameObject.SetActive(false);
            }
            return;
        }

        if (monitorBreathing)
        {
            hasOxygen = !PlayerManager.LocalPlayerScript.playerHealth.IsRespiratoryArrest && !PlayerManager.LocalPlayerScript.playerHealth.respiratorySystem.IsSuffocating;
            if (!hasOxygen && !oxygenAlert.gameObject.activeInHierarchy)
            {
                oxygenAlert.gameObject.SetActive(true);
            }

            if (hasOxygen && oxygenAlert.gameObject.activeInHierarchy)
            {
                oxygenAlert.gameObject.SetActive(false);
            }
        }
        // Handles temperature alert UI element
        if (monitorTemp && tempStatusCache != PlayerManager.LocalPlayerScript.playerHealth.TempStatus)
        {
            tempStatusCache = PlayerManager.LocalPlayerScript.playerHealth.TempStatus;
            if ((tempStatusCache == UI_TempAlert.TempChecker.tooHigh | tempStatusCache == UI_TempAlert.TempChecker.tooLow) && !tempAlert.gameObject.activeInHierarchy)
            {
                Logger.LogError("Enabled Temp Guage");
                tempAlert.gameObject.SetActive(true);
            }
            if ((tempStatusCache == UI_TempAlert.TempChecker.noAlert) && tempAlert.gameObject.activeInHierarchy)
            {
                Logger.LogError("Disabled Temp Guage");
                tempAlert.gameObject.SetActive(false);
            }
        }
        // Handles pressure alert UI element
        if (monitorPressure && (pressureStatusCache != PlayerManager.LocalPlayerScript.playerHealth.PressureStatus))
        {
            pressureStatusCache = PlayerManager.LocalPlayerScript.playerHealth.PressureStatus;
            Logger.LogWarning(pressureStatusCache.ToString());
            if ((pressureStatusCache == UI_PressureAlert.PressureChecker.tooHigh | pressureStatusCache == UI_PressureAlert.PressureChecker.tooLow) && !pressureAlert.gameObject.activeInHierarchy)
            {
                Logger.LogError("Enabled Pressure Gauge");
                pressureAlert.gameObject.SetActive(true);
            }
            if ((pressureStatusCache == UI_PressureAlert.PressureChecker.noAlert) && pressureAlert.gameObject.activeInHierarchy)
            {
                Logger.LogError("Disabled Pressure Gauge");
                pressureAlert.gameObject.SetActive(false);
            }
        }

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

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