private void EnergyFTSUpdate(GameTime timeSpent) { if (_playerCharacter.BindedSoulStone == null && _playerSpawnLocation == default(Vector3D)) { //Player not binded to a soulstone, remember player spawn location for ressurection only. _playerSpawnLocation = _playerCharacter.Position; } Vector3D BindingPosition = _playerCharacter.BindedSoulStone != null ? _playerCharacter.BindedSoulStone.Position : _playerSpawnLocation; _isWithinSoulStoneRange = Vector3D.DistanceSquared(BindingPosition, _playerCharacter.Position) <= 1024d; if (_isWithinSoulStoneRange == false && _ressurectionState == ressurectionStates.PreventRessurection) { _ressurectionState = ressurectionStates.None; } if (_playerCharacter.HealthState == Shared.Entities.Dynamic.DynamicEntityHealthState.Dead) { if (!_isWithinSoulStoneRange || _ressurectionState == ressurectionStates.PreventRessurection) { return; } else { if (_ressurectionState != ressurectionStates.PendingRequest) { _ressurectionState = ressurectionStates.PendingRequest; //Show resurect Box _guiManager.MessageBox("Do you want to be resurrected ?", "SoulStone", new string[] { "Yes", "No" }, ResurectionRequest); } return; } } //Auto Regen Stamina var staminaRegenForRunning = _staminaRegenAmountPerSecond * timeSpent.ElapsedGameTimeInS_LD; _playerCharacter.Stamina.CurrentValue += staminaRegenForRunning; if (_playerCharacter.Oxygen.CurrentValue <= 0) { _playerCharacter.HealthState = Shared.Entities.Dynamic.DynamicEntityHealthState.Drowning; DrowningDamage(timeSpent); } if (IsHeadInsideWater) { OxygenForUnderWaterSwimming(timeSpent); } if (!IsHeadInsideWater && _playerCharacter.Oxygen.CurrentAsPercent < 1) { _playerCharacter.Oxygen.CurrentValue = _playerCharacter.Oxygen.MaxValue; _playerCharacter.HealthState = Shared.Entities.Dynamic.DynamicEntityHealthState.Normal; } }
private void ResurectionRequest(string action) { switch (action.ToLower()) { case "yes": DeactivateDeadState(); _ressurectionState = ressurectionStates.None; break; case "no": _ressurectionState = ressurectionStates.PreventRessurection; break; default: break; } }