/// <summary> /// Kills ball when the death timer finishes /// </summary> void HandleDeathTimerFinished() { // invoke event and destroy self AudioManager.Play(AudioClipName.BallDeath); ballDiedEvent.Invoke(); Destroy(gameObject); }
/// <summary> /// PickUp collison checking method /// </summary> /// <param name="collision"></param> private void OnCollisionEnter2D(Collision2D collision) { // Checks for specific pick up ball types and then invokes for Right Paddle if (collision.gameObject.CompareTag("RightPaddle")) { // Freezer Effect (Right Side) //if (collision.gameObject.CompareTag("FreezeEffect")) if (ballType == PickUpEffectsEnum.FreezerEffect) { freezerEffectActivated.Invoke(ScreenSide.Right, freezeDuration); ballDiedEvent.Invoke(); } // Speed Up Effect //if (collision.gameObject.CompareTag("SpeedUpEffect")) if (ballType == PickUpEffectsEnum.SpeedUpEffect) { //speedUpEffectActiveEvent.Invoke(speedUpDuration, speedUpEffectSpeed); SpeedUpActive(speedUpDuration, speedUpEffectSpeed); ballDiedEvent.Invoke(); Destroy(gameObject); } Destroy(gameObject); } else if (collision.gameObject.CompareTag("LeftPaddle")) { // Freezer Effect (Left Side) //if (collision.gameObject.CompareTag("FreezeEffect")) if (ballType == PickUpEffectsEnum.FreezerEffect) { freezerEffectActivated.Invoke(ScreenSide.Left, freezeDuration); ballDiedEvent.Invoke(); } // Speed Up Effect //if (collision.gameObject.CompareTag("SpeedUpEffect")) if (ballType == PickUpEffectsEnum.SpeedUpEffect) { //speedUpEffectActiveEvent.Invoke(speedUpDuration, speedUpEffectSpeed); SpeedUpActive(speedUpDuration, speedUpEffectSpeed); ballDiedEvent.Invoke(); Destroy(gameObject); } Destroy(gameObject); } }
/// <summary> /// Kills ball when the death timer finishes /// </summary> void HandleDeathTimerFinished() { // invoke event and destroy self ballDiedEvent.Invoke(); Destroy(gameObject); }
/// <summary> /// Ball Death timer Event Method /// </summary> public virtual void BallDeathTimer() { Destroy(gameObject); ballDiedEvent.Invoke(); }
void TimerEventFinished() { ballDiedEvent.Invoke(); Destroy(gameObject); }