Interface definitions for the golf course kit. IGolfCourseBall describes the minimal ball surface the course pieces use. IGolfCourseEvents declares scene event callbacks the host invokes for cups, out-of-bounds zones and barbed wire interactions.
using Sandbox;
/// <summary>
/// A ball as the course pieces see it: the cup, the out-of-bounds zones, the rotating props and
/// the barbed wire need this much and no more. The game's ball component implements it; the kit
/// never references the game.
/// </summary>
public interface IGolfCourseBall
{
GameObject GameObject { get; }
Vector3 WorldPosition { get; set; }
Rigidbody Rigidbody { get; }
float Radius { get; }
bool IsHoled { get; }
string OwnerName { get; }
}
/// <summary>
/// What the course pieces report, as scene events, on the host only. The game implements this on
/// a component or a GameObjectSystem and does the scoring, the penalties and the damage. Players
/// are passed as the GameObject the trigger touched (the one tagged "player" for the wire); the
/// game resolves them to its own types.
/// </summary>
public interface IGolfCourseEvents : ISceneEvent<IGolfCourseEvents>
{
/// <summary>A ball that is not holed yet reached a cup's trigger.</summary>
void OnBallInCup( Hole hole, IGolfCourseBall ball );
/// <summary>A ball that is not holed entered a placed out-of-bounds zone.</summary>
void OnBallOutOfBounds( GolfOutOfBounds zone, IGolfCourseBall ball );
/// <summary>Something that is not a ball entered an out-of-bounds zone: the GameObject the trigger touched.</summary>
void OnBodyOutOfBounds( GolfOutOfBounds zone, GameObject body );
/// <summary>A player's body (the GameObject tagged "player") stepped into barbed wire.</summary>
void OnWireEntered( GolfBarbedWire wire, GameObject walker );
/// <summary>A player's body left barbed wire; the walker may be invalid if it was destroyed in there.</summary>
void OnWireLeft( GolfBarbedWire wire, GameObject walker );
/// <summary>A scrape is due for a player in barbed wire: on entry and every Damage Interval after.</summary>
void OnWireScrape( GolfBarbedWire wire, GameObject walker );
}