Exemple #1
0
        private void Update()
        {
            _timeLeft -= DayNightCycle.main.deltaTime;
            if (_timeLeft < 0)
            {
                OxygenManager?.GenerateOxygen();
                _timeLeft = 1f;
            }

            HealthManager?.HealthChecks();
            HealthManager?.UpdateHealthSystem();
            PowerManager?.ConsumePower();
            PowerManager?.UpdatePowerState();
        }
Exemple #2
0
        private void Update()
        {
            if (_display != null)
            {
                _display.UpdatePlayerHealthPercent(IsPlayerInTrigger ? Mathf.CeilToInt(Player.main.liveMixin.health) : 0);
            }

            OnMonoUpdate?.Invoke();

            if (!_isHealing)
            {
                return;
            }

            _healingStatus = HealingStatus.Healing;

            QuickLogger.Debug("Healing Player", true);

            _timeCurrDeltaTime += DayNightCycle.main.deltaTime;

            QuickLogger.Debug($"Delta Time: {_timeCurrDeltaTime}");
            if (!(_timeCurrDeltaTime >= 1))
            {
                return;
            }

            QuickLogger.Debug("Delta Passed", true);

            _timeCurrDeltaTime = 0.0f;

            var playerHealth    = Player.main.liveMixin.health;
            var playerMaxHealth = Player.main.liveMixin.maxHealth;

            _nitrogenLevel.safeNitrogenDepth =
                Mathf.Clamp(_nitrogenLevel.safeNitrogenDepth -= _nitrogenPartial, 0, float.MaxValue);


            if (!Player.main.liveMixin.IsFullHealth())
            {
                QuickLogger.Debug("Added Health", true);
                PowerManager.ConsumePower(PowerManager.EnergyConsumptionPerSecond);
                Player.main.liveMixin.health = Mathf.Clamp(playerHealth + _healthPartial, 0, playerMaxHealth);
                QuickLogger.Debug($"Player Health = {playerHealth}", true);
            }
            else
            {
                ResetMachine();
            }
        }