Abstract base component for a power-up effect in the Breakout game. Subclasses implement Apply to modify game state when a paddle collects a power-up, and can provide a short label and label color for UI feedback.
using Sandbox;
namespace Breakout;
/// <summary>
/// Base class for a power-up's actual effect. A PowerUp catches the pickup and calls Apply on each
/// of these, so a single pickup can carry several effects. Label (and its color) is the little text
/// shown when it's collected.
/// </summary>
public abstract class PowerUpEffect : Component
{
/// <summary>
/// Runs this effect. Called when the player catches the pickup carrying it.
/// </summary>
public abstract void Apply( BreakoutGame game, Paddle paddle );
/// <summary>
/// Short text shown when the pickup is collected (null shows nothing).
/// </summary>
public virtual string Label => null;
/// <summary>
/// Colour of the collected-pickup text.
/// </summary>
public virtual Color LabelColor => Color.White;
}