Table of Contents

Interface ITargetingService

Namespace
MoonBark.GridPlacement.Core.Services.Targeting
Assembly
MoonBark.GridPlacement.Core.dll

Manages the current target position on the grid, regardless of input source. This service coordinates between multiple input sources and provides a unified target position for placement systems.

public interface ITargetingService

Properties

ActiveInputSource

Gets the currently active input source, if any.

IInputSource? ActiveInputSource { get; }

Property Value

IInputSource

CurrentTargetPosition

Gets the current target position on the grid.

CoreVector2I CurrentTargetPosition { get; }

Property Value

CoreVector2I

Revision

Gets a monotonically increasing revision number that changes whenever the target state changes.

long Revision { get; }

Property Value

long

Methods

RegisterInputSource(IInputSource)

Registers an input source with the targeting service.

void RegisterInputSource(IInputSource source)

Parameters

source IInputSource

The input source to register.

SetActiveInputSource(InputSourceType)

Sets the active input source by type. If multiple sources of the same type exist, the first registered one is used.

bool SetActiveInputSource(InputSourceType sourceType)

Parameters

sourceType InputSourceType

The type of input source to activate.

Returns

bool

true if the source was found and activated; otherwise false.

TrySetTargetPosition(CoreVector2I)

Attempts to set the current target position.

bool TrySetTargetPosition(CoreVector2I newPosition)

Parameters

newPosition CoreVector2I

The new target position.

Returns

bool

true if the position changed; otherwise false.

UnregisterInputSource(IInputSource)

Unregisters an input source from the targeting service.

void UnregisterInputSource(IInputSource source)

Parameters

source IInputSource

The input source to unregister.

Events

ActiveSourceChanged

Raised when the active input source changes.

event Action<IInputSource?>? ActiveSourceChanged

Event Type

Action<IInputSource>

TargetPositionChanged

Raised when the target position changes.

event Action<CoreVector2I>? TargetPositionChanged

Event Type

Action<CoreVector2I>