Skip to main content

QuestMarker

A class in Root.Township, Features.Gameplay.Progression.QuestMarkers.

A floating quest marker that shows while all its game conditions are met and scales, rises and turns to face the player by distance. Client only; updated by QuestMarkerDataUpdater.

Constructors​

MemberWhat it is
QuestMarker()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

15 private and internal fields
MemberWhat it is
private AnimationCurve distanceHeightCurveSquaredCurve from squared flat distance to marker height.
private AnimationCurve distanceScalingCurveSquaredCurve from squared flat distance to marker scale.
private float distanceSqrLast squared flat distance to the player.
private float heightCurrent eased height.
private float heightTargetHeight the marker eases toward.
private float interpolationSpeedHow fast scale and height ease toward their targets.
private Vector3 lookDirectionFlat direction from the marker to the player's head.
private Vector3 markerLocalPositionCached local position of the marker transform.
private Vector3 markerPositionCached world position of the marker transform.
private Transform markerTransformThe marker object that is shown, scaled and raised.
private RateLimiter rateLimiterLimits how often target scale and height are recalculated.
private float scaleCurrent eased scale.
private float scaleTargetScale the marker eases toward.
private int targetTicksPerSecondTarget recalculations per second (0 for unlimited).
private Object[] visibilityConditionsIGameCondition objects that must all be met for the marker to show.

Methods​

MemberWhat it is
void UpdateMarker(Vector3 newPlayerHeadPosition)Called with the player's head position: recalculates targets when not rate limited, then eases scale and height and turns to face the player.
12 private and internal methods
MemberWhat it is
private void AllConditionsMet(bool areAllConditionsMet)Shows or hides the marker object.
private bool AreAllConditionsMet()True if every visibility condition is met.
private void ConditionChanged()Rechecks the conditions when one changes.
private void ListenForConditionChanges()Subscribes to every condition's change callback.
private void OnDestroy()Unregisters from QuestMarkerDataUpdater and stops listening to conditions.
private void OnDrawGizmosSelected()Editor: draws the height range and the near and far distance spheres.
private void Start()Client: registers with QuestMarkerDataUpdater, listens to conditions and sets initial visibility. Skipped on a headless server.
private void StopListeningForCompletionChanges()Unsubscribes from every condition's change callback.
private void UpdateLookPosition(Vector3 newPlayerHeadPosition)Sets the flat direction from the marker to the player's head.
private void UpdateMarkerHeight()Eases the marker's local height toward the target.
private void UpdateMarkerScale()Eases the marker's scale toward the target.
private void UpdateMarkerYRotationToLookAtPlayer()Turns this object on the Y axis to face the player.

Used in​

Members of other types that take, return or hold a QuestMarker: