Skip to main content

Class NavigationArrowPanel

Abstract base class to use for navigation arrow panel interface.

public abstract class NavigationArrowPanel : MonoBehaviour, IHandle<NavigationMessages.NavigationDirectionMessage>

Inheritance​

Derived​

Implements​

IHandle<NavigationMessages.NavigationDirectionMessage>

Remarks​

This panel component is designed with the assumption that all instances in the scene will receive navigation updates from a single actor only (typically the player). If multiple actors in the scene send NavigationDirectionMessage events, it will cause conflicts and unreliable readings, as all panel instances will respond to messages from every actor indiscriminately. Ensure only one actor/system broadcasts navigation updates per scene.

Fields​

m_ChannelKey​

Optional channel key to listen NavigationDirectionMessage?text=Navigation+Direction+messages on. If null, the relay subscribes on the default channel. Assign in the Inspector to scope this relay to a specific event channel.

[SerializeField]
protected Optional<ChannelKey> m_ChannelKey

Field Value​

Optional<ChannelKey>

Methods​

Handle(NavigationDirectionMessage)​

Handles incoming NavigationDirectionMessage events by processing the angle toward the target waypoint.

public abstract void Handle(NavigationMessages.NavigationDirectionMessage message)

Parameters​

NameTypeDescription
messageNavigationMessages.NavigationDirectionMessageThe navigation direction message containing the angle in degrees between the actor's forward direction and the direction toward the target waypoint.

OnDestroy()​

Called when the panel is destroyed. Unsubscribes this panel from the IEventAggregator.

protected virtual void OnDestroy()

SelectSectorIndex<T>(RadialSelectorItem<T>[], float)​

Determines which RadialSelectorItem sector a given angle lies within, using the starting angle of each sector as boundaries.

protected int SelectSectorIndex<T>(NavigationArrowPanel.RadialSelectorItem<T>[] items, float angleDeg)

Parameters​

NameTypeDescription
itemsNavigationArrowPanel.RadialSelectorItem<T>[]Array of RadialSelectorItem elements that define the sectors.
angleDegfloatThe input angle in degrees to test, measured clockwise from zero.

Returns​

int — The index of the sector in items that contains the specified angle. Returns -1 if items is null or empty. Returns 0 if only one item exists.

Type Parameters​

NameTypeDescription
TThe data type stored in each radial selector item.

Start()​

Called when the panel is initialized. Subscribes this panel to the IEventAggregator for navigation direction messages.

protected virtual void Start()
  • Remarks
  • Fields
    • m_ChannelKey
  • Methods
    • Handle(NavigationDirectionMessage)
    • OnDestroy()
    • SelectSectorIndex<T>(RadialSelectorItem<T>[], float)
    • Start()