Class GameTile
Represents a single tile in a grid-based game system.
Flexible design supports board games, 2D adventure games, puzzles, and more.
Assembly: PopcorningGuineaPig.Engine.dll
Syntax
Constructors
|
Edit this page
View Source
GameTile(int, int, Vector3, Vector2)
Creates a new GameTile with specified position and size.
Declaration
public GameTile(int gridX, int gridY, Vector3 worldPosition, Vector2 size)
Parameters
| Type |
Name |
Description |
| int |
gridX |
Grid X coordinate
|
| int |
gridY |
Grid Y coordinate
|
| Vector3 |
worldPosition |
3D world position
|
| Vector2 |
size |
Tile size (width, height)
|
Properties
|
Edit this page
View Source
Bounds
Declaration
public BoundingBox Bounds { get; set; }
Property Value
| Type |
Description |
| BoundingBox |
|
|
Edit this page
View Source
GridX
Declaration
public int GridX { get; set; }
Property Value
|
Edit this page
View Source
GridY
Declaration
public int GridY { get; set; }
Property Value
|
Edit this page
View Source
IsDropTarget
Declaration
public bool IsDropTarget { get; set; }
Property Value
|
Edit this page
View Source
IsHighlighted
Declaration
public bool IsHighlighted { get; set; }
Property Value
|
Edit this page
View Source
IsInteractable
Declaration
public bool IsInteractable { get; set; }
Property Value
|
Edit this page
View Source
IsOccupied
Declaration
public bool IsOccupied { get; set; }
Property Value
|
Edit this page
View Source
IsWalkable
Declaration
public bool IsWalkable { get; set; }
Property Value
|
Edit this page
View Source
Declaration
public object? Metadata { get; set; }
Property Value
|
Edit this page
View Source
Occupant
Declaration
public object? Occupant { get; set; }
Property Value
|
Edit this page
View Source
Position
Declaration
public Vector3 Position { get; set; }
Property Value
|
Edit this page
View Source
Size
Declaration
public Vector2 Size { get; set; }
Property Value
|
Edit this page
View Source
Type
Declaration
public TileType Type { get; set; }
Property Value
Methods
|
Edit this page
View Source
ClearOccupant()
Removes any occupant from this tile.
Declaration
public object? ClearOccupant()
Returns
| Type |
Description |
| object |
The removed occupant, if any
|
|
Edit this page
View Source
ContainsPosition(Vector3)
Checks if a world position is within this tile's bounds.
Declaration
public bool ContainsPosition(Vector3 worldPosition)
Parameters
| Type |
Name |
Description |
| Vector3 |
worldPosition |
3D world position to test
|
Returns
| Type |
Description |
| bool |
True if position is within tile bounds
|
|
Edit this page
View Source
GetGridDistance(GameTile)
Gets the 2D distance from this tile to another tile (grid coordinates).
Declaration
public float GetGridDistance(GameTile other)
Parameters
| Type |
Name |
Description |
| GameTile |
other |
Other tile
|
Returns
| Type |
Description |
| float |
Grid distance
|
|
Edit this page
View Source
GetWorldDistance(GameTile)
Gets the world distance from this tile's center to another tile's center.
Declaration
public float GetWorldDistance(GameTile other)
Parameters
| Type |
Name |
Description |
| GameTile |
other |
Other tile
|
Returns
| Type |
Description |
| float |
World distance
|
|
Edit this page
View Source
SetOccupant(object?)
Places an occupant on this tile, removing any previous occupant.
Declaration
public object? SetOccupant(object? occupant)
Parameters
| Type |
Name |
Description |
| object |
occupant |
Object to place on this tile
|
Returns
| Type |
Description |
| object |
The previous occupant, if any
|
|
Edit this page
View Source
ToString()
Returns a string that represents the current object.
Declaration
public override string ToString()
Returns
| Type |
Description |
| string |
A string that represents the current object.
|
Overrides