private void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.tag == "Bullet") { ssc.StartShake(ssc.length, ssc.power); } else if (other.gameObject.tag == "Bomb") { ssc.StartShake(ssc.bigLength, ssc.bigPower); } else if (other.gameObject.tag == "HomingMissile") { ssc.StartShake(ssc.mediumLengh, ssc.mediumPower); } }
void Update() { //if pressing the shoot button ->> SHOOT if (pm.ButtonShoot && !onCoolDown) { Fire(); ssc.StartShake(ssc.length, ssc.power); } //while the big boy nuke is in the air, shake the screen if (BigBoyInAir == true) { ssc.StartShake(ssc.length, ssc.power); } //Check if laser should render + shake the screen a little checkLaserActive(); checkFlameThrower(); }
public void HealthChange(int changeAmount) { if (changeAmount < 0 && !IsInvulnerable()) { uiHitAnimator.SetTrigger("Hit"); invulnerabilityTimer = 0f; screenShakeController.StartShake(.5f, 1); health = health + changeAmount; healthText.text = health.ToString(); playerSprite.color = Color.red; audioManager.Play("PlayerHurt", 0); } else if (changeAmount > 0) { health = health + changeAmount; healthText.text = health.ToString(); } }