PlacementService2D

AUTO-GENERATED FILE – DO NOT EDIT MANUALLY

This page documents the supported public API surface only. Private, internal, benchmark, test, and implementation-detail types are intentionally omitted.

Declaration

1
public class PlacementService2D : IService, IPlacementService

Summary

Minimal concrete implementation of IPlacementService for core TDD.

This version keeps an in-memory map of placed objects keyed by world position. It is intentionally simple and engine-agnostic, suitable for unit testing.

OBSOLETE: This service is replaced by modern ECS placement systems. Use PlacementSystem and related ECS systems for new development.

Metadata

Namespace: GridPlacement.Core.Services.Placement

Source File: cs/Core/Services/Placement/PlacementService2D.cs

Assembly: GridPlacement.Core

Type: class

Implements

  • IPlacementService
  • IService

Constructors

PlacementService2D

1
2
3
4
public PlacementService2D(
    IEventBus? eventBus = null,
    IConfigurationProvider<PlacementConfiguration>? configProvider = null
)

Initializes a new instance of the PlacementService2D class with a default state.

Parameters

NameDescription
eventBusThe event bus to publish events to.
configProviderThe configuration provider for placement settings.

Properties

IsReady

1
public bool IsReady { get; }

Gets a value indicating whether the service is ready to accept placement requests.


Methods

GetSnapshot

1
public Snapshot GetSnapshot()

ValidatePlacement

1
2
3
4
5
public PlacementReport ValidatePlacement(
    Placeable placeable,
    CoreVector2 position,
    IOwner? placer = null
)

Validates a placement request at the given position.

Parameters

NameDescription
placeableThe placeable definition to place.
positionThe world position to place at.
placerOptional owner context for the placer.

Returns

A report describing whether the placement is valid and any issues found.


ValidateSnapshot

1
2
3
4
5
public PlacementReport ValidateSnapshot(
    Placeable placeable,
    GridPlacement.Core.Types.TargetingSnapshot2D snapshot,
    int rotation
)

ComputePreviewModel

1
2
3
4
5
public PreviewModel ComputePreviewModel(
    Placeable placeable,
    GridPlacement.Core.Types.TargetingSnapshot2D snapshot,
    int rotation
)

ExecutePlacement

1
2
3
4
5
public GridPlacement.Core.Results.PlacementResult ExecutePlacement(
    Placeable placeable,
    CoreVector2 position,
    IOwner? placer = null
)

Executes a placement request at the given position.

Parameters

NameDescription
placeableThe placeable definition to place.
positionThe world position to place at.
placerOptional owner context for the placer.

Returns

The result of attempting to place the object.


RemoveObject

1
2
3
4
public bool RemoveObject(
    CoreVector2 position,
    IOwner? remover = null
)

Removes any object at the given position.

Parameters

NameDescription
positionThe position to remove from.
removerOptional owner context for the remover.

Returns

true if an object was removed; otherwise false.


MoveObject

1
2
3
4
5
public bool MoveObject(
    CoreVector2 fromPosition,
    CoreVector2 toPosition,
    IOwner? mover = null
)

Moves an object from one position to another.

Parameters

NameDescription
fromPositionThe source position.
toPositionThe destination position.
moverOptional owner context for the mover.

Returns

true if the object was moved; otherwise false.


IsPositionOccupied

1
public bool IsPositionOccupied(CoreVector2 position)

Determines whether the given position is occupied by an object.

Parameters

NameDescription
positionThe position to check.

Returns

true if the position is occupied; otherwise false.


GetObjectsInArea

1
public IEnumerable<Placeable> GetObjectsInArea(CoreRect2I area)

Enumerates all placed objects within the given area.

Parameters

NameDescription
areaThe area to search for objects.

Returns

An enumeration of placeables within the given area.


GetObjectsByOwner

1
public IEnumerable<Placeable> GetObjectsByOwner(string ownerKey)

Enumerates all placed objects associated with the given owner key.

Parameters

NameDescription
ownerKeyThe owner key used to filter objects.

Returns

An enumeration of placeables that match the given owner key.


GetValidationIssues

1
public IEnumerable<string> GetValidationIssues()

Returns any global validation issues for the service.

Returns

An enumeration of validation issue messages.


ValidateObjectPlacement

1
2
3
4
public ValidationResult ValidateObjectPlacement(
    CoreVector2 position,
    string placeableType
)

Validates that a given placeable type could be placed at the specified position.

Parameters

NameDescription
positionThe position to validate.
placeableTypeThe placeable type identifier.

Returns

A validation result with any errors found.


Reset

1
public void Reset()

Clears all in-memory state held by this service.


ClearAllObjects

1
public void ClearAllObjects()

Removes all placed objects.