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
Methods
Handle(NavigationDirectionMessage)
Handles incoming NavigationDirectionMessage events by processing the angle toward the target waypoint.
public abstract void Handle(NavigationMessages.NavigationDirectionMessage message)
Parameters
| Name | Type | Description |
|---|---|---|
message | NavigationMessages.NavigationDirectionMessage | The 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
| Name | Type | Description |
|---|---|---|
items | NavigationArrowPanel.RadialSelectorItem<T>[] | Array of RadialSelectorItem elements that define the sectors. |
angleDeg | float | The 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
| Name | Type | Description |
|---|---|---|
T | The 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()