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
placementIdstringThe placement identifier.
placementNamestringThe placement display name.
sizeCoreVector2IThe 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
Cost
Gets or sets the placement/build cost.
public int Cost { get; set; }
Property Value
CustomProperties
Gets or sets custom placement properties.
public Dictionary<string, object> CustomProperties { get; set; }
Property Value
Description
Gets or sets a description of the placement.
public string Description { get; set; }
Property Value
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
PlacementName
Gets or sets the display name of the placement.
public string PlacementName { get; set; }
Property Value
PlacementType
Gets or sets the placement type/category.
public BuildingType PlacementType { get; set; }
Property Value
RequiresFoundation
Gets or sets a value indicating whether the placement requires a foundation.
public bool RequiresFoundation { get; set; }
Property Value
Rotation
Gets or sets the rotation angle.
public float Rotation { get; set; }
Property Value
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
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
gridPositionCoreVector2IPosition to check
occupiedPositionsHashSet<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
gridPositionCoreVector2IBuilding's grid position
gridCellSizefloatSize 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
gridPositionCoreVector2IPlacement's grid position
Returns
- List<CoreVector2I>
List of occupied grid positions