ColourBreakLevelDefinition.cs

Definition types and a level lookup for a match-3 style ColourBreak game. It defines an enum of objective kinds, an immutable level data class ColourBreakLevelDefinition, and a static ColourBreakLevels helper that exposes Count and a Get(levelIndex) returning one of ten hardcoded level definitions.

public enum ColourBreakObjectiveKind
{
	Score,
	ClearPieces,
	ClearColour,
	MakeSpecials,
	TriggerSpecials,
	ChainCombos
}

public sealed class ColourBreakLevelDefinition
{
	public int Index { get; }
	public string Name { get; }
	public string Brief { get; }
	public int TargetScore { get; }
	public int MoveLimit { get; }
	public int ColourCount { get; }
	public ColourBreakObjectiveKind ObjectiveKind { get; }
	public int ObjectiveTarget { get; }
	public int ObjectiveType { get; }

	public ColourBreakLevelDefinition(
		int index,
		string name,
		string brief,
		int targetScore,
		int moveLimit,
		int colourCount,
		ColourBreakObjectiveKind objectiveKind = ColourBreakObjectiveKind.Score,
		int objectiveTarget = 0,
		int objectiveType = -1 )
	{
		Index = index;
		Name = name;
		Brief = brief;
		TargetScore = targetScore;
		MoveLimit = moveLimit;
		ColourCount = colourCount;
		ObjectiveKind = objectiveKind;
		ObjectiveTarget = objectiveTarget;
		ObjectiveType = objectiveType;
	}
}

public static class ColourBreakLevels
{
	const int LevelTotal = 10;

	public static int Count => LevelTotal;

	public static ColourBreakLevelDefinition Get( int levelIndex )
	{
		return System.Math.Clamp( levelIndex, 1, LevelTotal ) switch
		{
			1 => new( 1, "First Break", "Make short chains and learn the board.", 650, 26, 4 ),
			2 => new( 2, "Colour Rush", "Break lime pieces while keeping the score moving.", 900, 24, 5, ColourBreakObjectiveKind.ClearColour, 14, 3 ),
			3 => new( 3, "Fuse Lines", "Create row and column specials to stay ahead.", 1250, 23, 5, ColourBreakObjectiveKind.MakeSpecials, 2 ),
			4 => new( 4, "Pressure Grid", "Trigger specials before the move count closes in.", 1550, 22, 6, ColourBreakObjectiveKind.TriggerSpecials, 3 ),
			5 => new( 5, "Cascade Run", "Build chain reactions instead of single clears.", 1900, 21, 6, ColourBreakObjectiveKind.ChainCombos, 3 ),
			6 => new( 6, "Break Point", "Break violet pieces and make every move count.", 2400, 22, 6, ColourBreakObjectiveKind.ClearColour, 20, 5 ),
			7 => new( 7, "Ruby Hunt", "A tighter board - clear ruby pieces under pressure.", 2700, 21, 6, ColourBreakObjectiveKind.ClearColour, 24, 0 ),
			8 => new( 8, "Chain Theory", "Long cascades are the only way through.", 3200, 20, 6, ColourBreakObjectiveKind.ChainCombos, 5 ),
			9 => new( 9, "Demolition", "Forge a stockpile of specials, then set them off.", 3700, 20, 6, ColourBreakObjectiveKind.TriggerSpecials, 6 ),
			_ => new( 10, "Spectrum", "The full palette, the full challenge. Master it.", 4500, 22, 6, ColourBreakObjectiveKind.ClearPieces, 120, -1 ),
		};
	}
}