Table of Contents

Class GameTile

Namespace
PopcorningGuineaPig.Engine.Gameplay
Assembly
PopcorningGuineaPig.Engine.dll

Represents a single tile in a grid-based game system. Flexible design supports board games, 2D adventure games, puzzles, and more.

public class GameTile
Inheritance
GameTile
Inherited Members

Constructors

GameTile(int, int, Vector3, Vector2)

Creates a new GameTile with specified position and size.

public GameTile(int gridX, int gridY, Vector3 worldPosition, Vector2 size)

Parameters

gridX int

Grid X coordinate

gridY int

Grid Y coordinate

worldPosition Vector3

3D world position

size Vector2

Tile size (width, height)

Properties

Bounds

public BoundingBox Bounds { get; set; }

Property Value

BoundingBox

GridX

public int GridX { get; set; }

Property Value

int

GridY

public int GridY { get; set; }

Property Value

int

IsDropTarget

public bool IsDropTarget { get; set; }

Property Value

bool

IsHighlighted

public bool IsHighlighted { get; set; }

Property Value

bool

IsInteractable

public bool IsInteractable { get; set; }

Property Value

bool

IsOccupied

public bool IsOccupied { get; set; }

Property Value

bool

IsWalkable

public bool IsWalkable { get; set; }

Property Value

bool

Metadata

public object? Metadata { get; set; }

Property Value

object

Occupant

public object? Occupant { get; set; }

Property Value

object

Position

public Vector3 Position { get; set; }

Property Value

Vector3

Size

public Vector2 Size { get; set; }

Property Value

Vector2

Type

public TileType Type { get; set; }

Property Value

TileType

Methods

ClearOccupant()

Removes any occupant from this tile.

public object? ClearOccupant()

Returns

object

The removed occupant, if any

ContainsPosition(Vector3)

Checks if a world position is within this tile's bounds.

public bool ContainsPosition(Vector3 worldPosition)

Parameters

worldPosition Vector3

3D world position to test

Returns

bool

True if position is within tile bounds

GetGridDistance(GameTile)

Gets the 2D distance from this tile to another tile (grid coordinates).

public float GetGridDistance(GameTile other)

Parameters

other GameTile

Other tile

Returns

float

Grid distance

GetWorldDistance(GameTile)

Gets the world distance from this tile's center to another tile's center.

public float GetWorldDistance(GameTile other)

Parameters

other GameTile

Other tile

Returns

float

World distance

SetOccupant(object?)

Places an occupant on this tile, removing any previous occupant.

public object? SetOccupant(object? occupant)

Parameters

occupant object

Object to place on this tile

Returns

object

The previous occupant, if any

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.