Table of Contents

Class PlacementData

Namespace
MoonBark.GridPlacement.Core.Data
Assembly
MoonBark.GridPlacement.Core.dll

Core placement data class Pure C# implementation without Godot dependencies

[Obsolete("Use MoonBark.GridPlacement.Core.Data.Placement.PlacementData instead", DiagnosticId = "GB_DEPRECATED_PLACEMENT_DATA")]
public class PlacementData
Inheritance
PlacementData
Inherited Members

Constructors

PlacementData()

Initializes a new instance of the PlacementData class.

public PlacementData()

PlacementData(string, string, CoreVector2I)

Initializes a new instance of the PlacementData class.

public PlacementData(string placementId, string placementName, CoreVector2I size)

Parameters

placementId string

The placement identifier.

placementName string

The placement display name.

size CoreVector2I

The placement footprint size in grid cells.

Properties

CanRotate

Gets or sets a value indicating whether the placement can be rotated.

public bool CanRotate { get; set; }

Property Value

bool

Cost

Gets or sets the placement/build cost.

public int Cost { get; set; }

Property Value

int

CustomProperties

Gets or sets custom placement properties.

public Dictionary<string, object> CustomProperties { get; set; }

Property Value

Dictionary<string, object>

Description

Gets or sets a description of the placement.

public string Description { get; set; }

Property Value

string

PivotOffset

Gets or sets the pivot offset in grid cells.

public CoreVector2I PivotOffset { get; set; }

Property Value

CoreVector2I

PlacementId

Gets or sets the placement identifier.

public string PlacementId { get; set; }

Property Value

string

PlacementName

Gets or sets the display name of the placement.

public string PlacementName { get; set; }

Property Value

string

PlacementType

Gets or sets the placement type/category.

public BuildingType PlacementType { get; set; }

Property Value

BuildingType

RequiresFoundation

Gets or sets a value indicating whether the placement requires a foundation.

public bool RequiresFoundation { get; set; }

Property Value

bool

Rotation

Gets or sets the rotation angle.

public float Rotation { get; set; }

Property Value

float

Size

Gets or sets the size of the placement footprint in grid cells.

public CoreVector2I Size { get; set; }

Property Value

CoreVector2I

TexturePath

Gets or sets the texture path for rendering.

public string TexturePath { get; set; }

Property Value

string

Methods

CanPlaceAt(CoreVector2I, HashSet<CoreVector2I>)

Checks if this building can be placed at the given position

public bool CanPlaceAt(CoreVector2I gridPosition, HashSet<CoreVector2I> occupiedPositions)

Parameters

gridPosition CoreVector2I

Position to check

occupiedPositions HashSet<CoreVector2I>

Currently occupied positions

Returns

bool

True if placement is valid

Clone()

Creates a copy of this placement data

public PlacementData Clone()

Returns

PlacementData

Copy of placement data

GetCenterPosition(CoreVector2I, float)

Gets the building's center position in world coordinates

public CoreVector2 GetCenterPosition(CoreVector2I gridPosition, float gridCellSize = 1)

Parameters

gridPosition CoreVector2I

Building's grid position

gridCellSize float

Size of a grid cell in world units

Returns

CoreVector2

Center world position

GetOccupiedPositions(CoreVector2I)

Gets the occupied grid positions for this placement

public List<CoreVector2I> GetOccupiedPositions(CoreVector2I gridPosition)

Parameters

gridPosition CoreVector2I

Placement's grid position

Returns

List<CoreVector2I>

List of occupied grid positions