private void CheckForPowerUps(Collision2D collision) { Dictionary <Powerup, bool> activePowerups = powerupHandler.GetActivePowerups(); if (activePowerups[Powerup.MAGNET_BALL]) { launchSpeed = rigidBody2D.velocity.magnitude; paddleToBallVector = this.transform.position - paddle.transform.position; if (collision.contacts[0].normal == Vector2.up) { launchVelocity = Vector2.Reflect(launchVelocity, collision.contacts[0].normal); launchVelocity.y = Mathf.Abs(launchVelocity.y); } else { launchVelocity = collision.contacts[0].normal; } gameMode.hasStarted = false; } }
public void HandleBlockCollision() { Dictionary <Powerup, bool> activePowerups = powerupHandler.GetActivePowerups(); if (blockType == BlockType.EXPLOSION) { HandleExplosionBlock(); } else if (blockType == BlockType.LINE_CLEAR) { Debug.Log("Clearing Line"); HandlerLineClear(); } if (activePowerups[Powerup.ONE_HIT_KILL]) { DestroyBlock(); return; } if (!isBreakable) { return; } timesHit++; if (timesHit >= health) { DestroyBlock(); } else { ShowNextHitSprite(); } }