FootballEnvironment.cs

Data components for a football stadium scene. Defines a root environment marker with a spectator count, per-section metadata holding lists of fan markers and line strokes, plus plain data classes for fan and stroke positions and colors.

using Sandbox;
using System.Collections.Generic;

// The authored root is saved in the ordinary match scene. The broadcast makes
// a runtime copy, so editor changes are the source of its environment geometry.
public sealed class FootballEnvironment : Component
{
    public const string SceneTag="football-environment";
    [Property] public int SpectatorCount {get;set;}
}

// Metadata is local to each editable section. Moving, rotating or scaling a
// stand carries both its solid geometry and its animated details with it.
public sealed class FootballEnvironmentSection : Component
{
    [Property] public string SectionId {get;set;}="";
    [Property] public List<FootballEnvironmentFan> Fans {get;set;}=new();
    [Property] public List<FootballEnvironmentStroke> FineStrokes {get;set;}=new();
}

public sealed class FootballEnvironmentFan
{
    public Vector3 LocalBase {get;set;}
    public Vector3 LocalRight {get;set;}=Vector3.Forward;
    public Vector3 LocalUp {get;set;}=Vector3.Up;
    public int Stand {get;set;}
    public int Hash {get;set;}
}

public sealed class FootballEnvironmentStroke
{
    public Vector3 LocalA {get;set;}
    public Vector3 LocalB {get;set;}
    // Engine units (inches), matching the local endpoint coordinates.
    public float Width {get;set;}
    public string Color {get;set;}="#ffffff";
}