private void _hpScript_HpChanged(object sender, HpChangedEventArgs e) { if (e.NewHp < e.PreviousHp) { _playerVibrator.Vibrate(_hpChangedVibrationSettings); } }
private void ComponentToListenToHpChanged(object sender, HpChangedEventArgs e) { if (e.NewHp < e.PreviousHp) { _cameraShaker.DoShake(_hpChangedShakeSettings); } }
protected virtual void HpScriptOnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs) { float newScalePercent = _originalX * (_hpScript.CurrentHp / _hpScript.MaxHp); _gameObjectToScale.transform.localScale = _gameObjectToScale.transform.localScale.SetX(newScalePercent); if (_isLowHpFlash && !_isFlashing && _hpScript.CurrentHp <= _lowHpValue) _isFlashing = true; else if (_isLowHpFlash && _isFlashing && _hpScript.CurrentHp > _lowHpValue) _isFlashing = false; }
protected override void HpScriptOnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs) { float newScalePercent = _originalX * (_hpScript.CurrentHp / _hpScript.MaxHp); if(_slowlyDecreaseBarRunning) { StopCoroutine(_slowlyDecreaseBarRoutine); _slowlyDecreaseBarRunning = false; } _slowlyDecreaseBarRoutine = SlowlyDecreaseBar(newScalePercent); StartCoroutine(_slowlyDecreaseBarRoutine); }
protected override void HpScriptOnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs) { float newScalePercent = _originalX * (_hpScript.CurrentHp / _hpScript.MaxHp); if (_slowlyDecreaseBarRunning) { StopCoroutine(_slowlyDecreaseBarRoutine); _slowlyDecreaseBarRunning = false; } _slowlyDecreaseBarRoutine = SlowlyDecreaseBar(newScalePercent); StartCoroutine(_slowlyDecreaseBarRoutine); }
protected virtual void OnHpChanged(HpChangedEventArgs e) { try { EventHandler<HpChangedEventArgs> handler = HpChanged; if (handler != null) handler(this, e); } catch (Exception ex) { ex.Log(); throw; } }
private void OnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs) { if (CurrentHp <= 0) { StartCoroutine(DestroyNextFrame()); } else if (CurrentHp > 0) { if (hpChangedEventArgs.PreviousHp > hpChangedEventArgs.NewHp) { StartFlicker(); } } }
protected virtual void HpScriptOnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs) { float newScalePercent = _originalX * (_hpScript.CurrentHp / _hpScript.MaxHp); _gameObjectToScale.transform.localScale = _gameObjectToScale.transform.localScale.SetX(newScalePercent); if (_isLowHpFlash && !_isFlashing && _hpScript.CurrentHp <= _lowHpValue) { _isFlashing = true; } else if (_isLowHpFlash && _isFlashing && _hpScript.CurrentHp > _lowHpValue) { _isFlashing = false; } }
private void OnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs) { if (hpChangedEventArgs.NewHp <= 0 && !_waitingForExplosionNoReturn) { //TimeToExplode if (_enableTimerBeforeExplosion) { _mainRigidbody.mass += _massAdditionWhenIgnited; StartCoroutine(TimerForExplosion()); } else { Kaboom(); } } }
protected virtual void OnHpChanged(HpChangedEventArgs e) { try { EventHandler <HpChangedEventArgs> handler = HpChanged; if (handler != null) { handler(this, e); } } catch (Exception ex) { ex.Log(); throw; } }
private void OnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs) { if (CurrentHp <= 0) StartCoroutine(DestroyNextFrame()); else if(CurrentHp > 0) { if (hpChangedEventArgs.PreviousHp > hpChangedEventArgs.NewHp) StartFlicker(); } }