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
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
Methods
RegisterInputSource(IInputSource)
Registers an input source with the targeting service.
void RegisterInputSource(IInputSource source)
Parameters
sourceIInputSourceThe 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
sourceTypeInputSourceTypeThe type of input source to activate.
Returns
- bool
trueif the source was found and activated; otherwisefalse.
TrySetTargetPosition(CoreVector2I)
Attempts to set the current target position.
bool TrySetTargetPosition(CoreVector2I newPosition)
Parameters
newPositionCoreVector2IThe new target position.
Returns
- bool
trueif the position changed; otherwisefalse.
UnregisterInputSource(IInputSource)
Unregisters an input source from the targeting service.
void UnregisterInputSource(IInputSource source)
Parameters
sourceIInputSourceThe input source to unregister.
Events
ActiveSourceChanged
Raised when the active input source changes.
event Action<IInputSource?>? ActiveSourceChanged
Event Type
TargetPositionChanged
Raised when the target position changes.
event Action<CoreVector2I>? TargetPositionChanged
Event Type
- Action<CoreVector2I>