Beispiel #1
0
 private void _hpScript_HpChanged(object sender, HpChangedEventArgs e)
 {
     if (e.NewHp < e.PreviousHp)
     {
         _playerVibrator.Vibrate(_hpChangedVibrationSettings);
     }
 }
Beispiel #2
0
 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);
 }
Beispiel #5
0
    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);
    }
Beispiel #6
0
 protected virtual void OnHpChanged(HpChangedEventArgs e)
 {
     try
     {
         EventHandler<HpChangedEventArgs> handler = HpChanged;
         if (handler != null) handler(this, e);
     }
     catch (Exception ex)
     {
         ex.Log();
         throw;
     }
 }
Beispiel #7
0
 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;
        }
    }
Beispiel #9
0
 private void OnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs)
 {
     if (hpChangedEventArgs.NewHp <= 0 && !_waitingForExplosionNoReturn)
     {
         //TimeToExplode
         if (_enableTimerBeforeExplosion)
         {
             _mainRigidbody.mass += _massAdditionWhenIgnited;
             StartCoroutine(TimerForExplosion());
         }
         else
         {
             Kaboom();
         }
     }
 }
Beispiel #10
0
 protected virtual void OnHpChanged(HpChangedEventArgs e)
 {
     try
     {
         EventHandler <HpChangedEventArgs> handler = HpChanged;
         if (handler != null)
         {
             handler(this, e);
         }
     }
     catch (Exception ex)
     {
         ex.Log();
         throw;
     }
 }
Beispiel #11
0
 private void OnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs)
 {
     if (CurrentHp <= 0) StartCoroutine(DestroyNextFrame());
     else if(CurrentHp > 0)
     {
         if (hpChangedEventArgs.PreviousHp > hpChangedEventArgs.NewHp)
             StartFlicker();
     }
 }
 private void OnHpChanged(object sender, HpChangedEventArgs hpChangedEventArgs)
 {
     if (hpChangedEventArgs.NewHp <= 0 && !_waitingForExplosionNoReturn)
     {
         //TimeToExplode
         if (_enableTimerBeforeExplosion)
         {
             _mainRigidbody.mass += _massAdditionWhenIgnited;
             StartCoroutine(TimerForExplosion());
         }
         else
         {
             Kaboom();
         }
     }
 }