예제 #1
0
 private void ResetMachine()
 {
     Player.main.playerController.SetEnabled(true);
     QuickLogger.Debug("Resetting", true);
     _healingStatus = HealingStatus.Idle;
     UpdateIsHealing(false);
     PowerManager.SetHasBreakerTripped(true);
 }
예제 #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();
            }
        }