TargetingService2D

TargetingService2D

Core implementation of grid targeting service providing engine-agnostic business logic for tile validation, pathfinding, and grid navigation. This service provides the heavy algorithms and business rules that Godot components can delegate to for optimal performance and testability.

Project: GridPlacement v6.0
Layer: Godot
Source: Godot/Core/Services/Targeting/TargetingService2D.cs
Namespace: GridBuilding.Core.Services.Targeting
Kind: class

Parsing Method: AST-based (Roslyn) - NOT regex

⚠️ IMPORTANT: This documentation was generated using AST parsing, not regex.

Properties

CurrentTargetTile

Gets the current target tile

IsTargetingActive

Checks if targeting is currently active

Configuration

Gets current targeting configuration

Methods

FindPath

Finds a path between two grid positions

Returns: List<CoreVector2I>

Parameters:

  • CoreVector2I startPosition
  • CoreVector2I endPosition

IsPathClear

Checks if a clear path exists between two positions

Returns: bool

Parameters:

  • CoreVector2I startPosition
  • CoreVector2I endPosition

GetPathDistance

Gets the path distance between two positions

Returns: float

Parameters:

  • CoreVector2I startPosition
  • CoreVector2I endPosition

GetClosestValidTile

Gets the closest valid tile to a target position

Returns: CoreVector2I

Parameters:

  • CoreVector2I targetPosition
  • CoreVector2I sourcePosition
  • int maxDistance

IsValidTargetTile

Validates if a tile position is valid for targeting

Returns: bool

Parameters:

  • CoreVector2I position

IsWalkableTile

Checks if a tile position is walkable

Returns: bool

Parameters:

  • CoreVector2I position

GetValidTilesInRadius

Gets all valid tiles within a specified radius

Returns: List<CoreVector2I>

Parameters:

  • CoreVector2I centerPosition
  • int radius

ValidateTilePlacement

Validates tile placement according to targeting rules

Returns: List<string>

Parameters:

  • CoreVector2I position
  • string? buildingType

UpdateGridNavigation

Updates the grid navigation data

Returns: void

Parameters:

  • GridNavigationData gridData

SetTileWalkability

Sets walkability for a specific tile

Returns: void

Parameters:

  • CoreVector2I position
  • bool isWalkable

SetTileWeight

Sets weight for a specific tile

Returns: void

Parameters:

  • CoreVector2I position
  • float weight

ClearNavigationData

Clears all navigation data

Returns: void

SetTargetTile

Sets the current target tile

Returns: void

Parameters:

  • CoreVector2I position

ClearTarget

Clears the current target

Returns: void

SetTargetingEnabled

Enables or disables targeting mode

Returns: void

Parameters:

  • bool enabled

UpdateConfiguration

Updates targeting configuration

Returns: void

Parameters:

  • TargetingConfiguration config

ValidateSetup

Validates the current targeting setup

Returns: List<string>

ValidateTargetAtPosition

Validates target at specific position for a targeting component

Returns: bool

Parameters:

  • CoreVector2I gridPosition
  • object? targetNode

GetClosestValidTarget

Gets the closest valid target to a desired position

Returns: CoreVector2I

Parameters:

  • CoreVector2I desiredPosition
  • object? sourceNode

GetValidTargetsInRange

Gets all valid targets within range of a center position

Returns: List<CoreVector2I>

Parameters:

  • CoreVector2I centerPosition
  • int range

UpdateTargetingComponentState

Updates the state of a targeting component

Returns: void

Parameters:

  • object component
  • CoreVector2I currentPosition

IsTargetingValidForComponent

Checks if a target is valid for a specific component

Returns: bool

Parameters:

  • object component
  • object target

Dispose

Disposes of the service resources

Returns: void