protected override void OnCollisionEnter2D(Collision2D collision) { //Run effect if (collision.gameObject.CompareTag("Ball")) { speedupEffectActivatedEvent.Invoke(speedupEffectDuration, speedupEffectForce); AudioManager.Play(AudioName.EffectSpeedupActivated); } base.OnCollisionEnter2D(collision); }
override protected void OnCollisionEnter2D(Collision2D collision) { if (typeBox == PickupEffect.Freezer) { freezerEffectActivated.Invoke(freezerEffectDuration); } else if (typeBox == PickupEffect.Speedup) { speedupEffectActivated.Invoke(speedupEffectDuration, speedupEffectSpeed); } base.OnCollisionEnter2D(collision); }
/// <summary> /// Sent when an incoming collider makes contact with this object's /// collider (2D physics only). /// </summary> /// <param name="other">The Collision2D data associated with this collision.</param> override protected void OnCollisionEnter2D(Collision2D other) { if (pickupEffect == PickupEffect.Freezer) { AudioManager.Play(AudioClipName.Freezer); freezerEffectActivated.Invoke(durationEffect); } else { AudioManager.Play(AudioClipName.Speedup); speedupEffectActivated.Invoke(durationEffect, effectSpeedup); } base.OnCollisionEnter2D(other); }
protected override void OnCollisionEnter2D(Collision2D other) { base.OnCollisionEnter2D(other); if (_effect == PickupEffect.Freezer) { _freezerEffectActivated.Invoke(_freezeEffectDuration); AudioManager.Play(AudioClipName.FreezeEffectStart); } else if (_effect == PickupEffect.Speedup) { _speedupEffectActivated.Invoke(_speedupEffectDuration, _speedupFactor); AudioManager.Play(AudioClipName.SpeedupEffect); } }
/// <summary> /// Invokes the pickup effect event and destroys the block on collision with a ball /// </summary> /// <param name="coll">Coll.</param> override protected void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.CompareTag("Ball")) { if (effect == PickupEffect.Freezer) { freezerEffectActivated.Invoke(duration); } else if (effect == PickupEffect.Speedup) { speedupEffectActivated.Invoke(duration, speedupFactor); } base.OnCollisionEnter2D(coll); } }
protected override void OnCollisionEnter2D(Collision2D coll) { if (this.pickupEffect == PickupEffect.Freezer) { AudioManager.Play(AudioClipName.Freeze); freezerEventActivated.Invoke(this.freezeDuration); } if (this.pickupEffect == PickupEffect.Speedup) { AudioManager.Play(AudioClipName.Speedup); speedupEventActivated.Invoke(this.speedupDuration); } base.OnCollisionEnter2D(coll); }
override protected void OnCollisionEnter2D(Collision2D collision) { if (blockType == 0) { Instantiate(effect[0], transform.position, Quaternion.identity); freezerEffectActivated.Invoke(effectDuration); addPointsEvent.Invoke(blockValue); AudioManager.Play(AudioClipName.Freeze); } else { Instantiate(effect[1], transform.position, Quaternion.identity); speedupEffectActivated.Invoke(effectDuration, speedupFactor); AudioManager.Play(AudioClipName.SpeedUp); } base.OnCollisionEnter2D(collision); }
/// <summary> /// Invokes the pickup effect event and destroys the block on collision with a ball /// </summary> /// <param name="coll">Coll.</param> override protected void OnCollisionEnter2D(Collision2D coll) { if (coll.gameObject.CompareTag("Ball")) { if (effect == PickupEffect.Freezer) { AudioManager.Play(AudioClipName.Freeze); freezerEffectActivated.Invoke(duration); } else if (effect == PickupEffect.Speedup) { AudioManager.Play(AudioClipName.SpeedUp); speedupEffectActivated.Invoke(duration, speedupFactor); } base.OnCollisionEnter2D(coll); } }
/// <summary> /// Adds logic no base OnCollisionEnter2D to handle collisions with Effect blocks /// </summary> /// <param name="col"></param> protected override void OnCollisionEnter2D(Collision2D col) { if (col.gameObject.CompareTag("Ball")) { //effect of this block is freezer/speedup if (effectThisBlock == PickupEffect.Freezer) { freezerEffectActivated.Invoke(freezeEffectDuration); } else if (effectThisBlock == PickupEffect.Speedup) { speedupEffectActivated.Invoke(speedupEffectDuration); } base.OnCollisionEnter2D(col); } }
protected override void OnCollisionEnter2D(Collision2D collision) { switch (PickupEffect) { case PickupEffect.Freezer: freezerEffectActivated.Invoke(ConfigurationUtils.FreezerDurationSeconds); break; case PickupEffect.Speedup: speedupEffectActivated.Invoke(ConfigurationUtils.SpeedupDurationSeconds, ConfigurationUtils.SpeedupFactor); break; default: throw new ArgumentOutOfRangeException(); } base.OnCollisionEnter2D(collision); }
protected override void OnCollisionEnter2D(Collision2D other) { // Debug.Log("Now " + _effect); if (_effect == PickupEffect.Freezer) { _freezerEffectActivated.Invoke(_freezeEffectDuration); // Debug.Log("Settings freeze..."); } else if (_effect == PickupEffect.Speedup) { _speedupEffectActivated.Invoke(_speedupEffectDuration, _speedupFactor); // Debug.Log("Settings speedup..."); } base.OnCollisionEnter2D(other); // HUD.AddScorePoints(CostBlock); // Destroy(gameObject); }
protected override void OnCollisionEnter2D(Collision2D coll) { freezerEventActivated.Invoke(effectDuration); speedupEventActivated.Invoke(effectDuration, speedupFactor); base.OnCollisionEnter2D(coll); }