ObjectiveMarker.cs
using Sandbox;
// Put this on anything the player should be pointed at - the robbery, the
// escape zone, a future objective. ObjectiveMarkerHud finds every enabled
// one in the scene and draws a waypoint for it.
//
// Visibility is just this component's Enabled state, which makes the
// common cases free:
//
// - The escape zone's whole GameObject is disabled until MissionTimer
// activates it, so a marker on it appears exactly when the exit opens.
// - MissionStartTrigger switches its own marker off once the job begins.
public sealed class ObjectiveMarker : Component
{
[Property]
public string Label { get; set; } = "Objective";
[Property]
public Color Color { get; set; } = Color.White;
// Lifts the marker off the object's origin, which usually sits on the
// floor. Without this a waypoint hovers around people's ankles.
[Property]
public Vector3 Offset { get; set; } = Vector3.Up * 64f;
// Hide the distance readout for things where it's noise rather than
// useful.
[Property]
public bool ShowDistance { get; set; } = true;
public Vector3 MarkerPosition => WorldPosition + Offset;
}