public override void OnHit(float damage, Transform damagedBy) { _freeze = true; _objectShake.Shake(); base.OnHit(damage, damagedBy); StartCoroutine(Unfreeze()); }
public virtual void TakeDamage(float damage) { if (dead) { return; } hp -= damage; StartCoroutine(_shake.Shake()); if (hp <= 0) { dead = true; Debug.Log(name + " being killed!"); OnDeath(); allies.Remove(this); } }
IEnumerator Shake() { while (gameObject) { _shake.Shake(); yield return(new WaitForSeconds(_shake.duration)); } }
public void CameraAction() { _Shaker.Shake(); if (_TimeSlowOn) { Time.timeScale = _SlowRate; } }
void OnHit(Collider other) { if ("The Word".Equals(other.tag)) { var theWord = other.GetComponent <ThePrayerWord> (); // MoveUp (_stepUp); _hp.TakeDamage(theWord.damage); _shake.Shake(); ChangeAppearance(); InstantiateHitFx(theWord.transform.position); theWord.SelfDestruct(); } if ("The Traitor Bullet".Equals(other.tag)) { var theTraitorBullet = other.GetComponent <TheTraitorBullet> (); _hp.TakeDamage(theTraitorBullet.damage); _shake.Shake(); theTraitorBullet.SelfDestruct(); } }
public void Damage() { Timelag(0.05f); BgShaker.Shake(ShakeTime, ShakeScale); GameManager.Inst().Player.Shaker.Shake(ShakeTime, ShakeScale); for (int i = 0; i < 4; i++) { if (GameManager.Inst().GetSubweapons(i) != null) { GameManager.Inst().GetSubweapons(i).Shaker.Shake(ShakeTime, ShakeScale); } } for (int i = 0; i < 4; i++) { GameManager.Inst().UiManager.MainUI.Center.Turrets[i].Shaker.Shake(ShakeTime, ShakeScale); } }