Skip to content

Building

namespace Griff.Modules.Strategy;
public sealed class Building : Component, INetState, ITeamMember

A building: it stands still, takes up its Size on the map (units walk around it), and belongs to a team. Workers put it up when it’s placed (see Builds); a Producer on it trains units, a Fighter makes it a tower, and Depot lets workers bring resources back to it.

This is a component: its saved properties are on its component page.

public float BuildTime { get; set; }

Seconds a worker takes to put it up.

public string? Cost { get; set; }

What it costs to build, e.g. “150 Gold, 50 Wood”.

public bool Depot { get; set; }

Whether workers bring gathered resources back here: a town hall.

public string? Hotkey { get; set; }

The key that builds it, e.g. “B”. Empty uses its first letter.

public bool IsBuilt { get; }

True once it’s finished: only then does it train, take resources, provide supply or shoot.

public bool IsSelected { get; }

True while the player has it selected.

public float Progress { get; set; }

How far along it is, from 0 (just placed) to 1 (finished). Buildings in a scene start finished.

public Vector2? Rally { get; set; }

Where units it trains walk to. Right-click with it selected to set it.

public Entity? RallyTarget { get; set; }

A resource units it trains go and gather from, if the rally point was set on one.

public float Sight { get; set; }

How far it sees through the fog of war.

public Vector2 Size { get; set; }

The ground it covers, in world units; units walk around it.

public int Supply { get; set; }

The supply it provides its team once it’s up: farms and houses.

public string? Team { get; set; }

The team it’s on: a Faction’s Team.

public event Action<Building>? Finished

Raised when it’s finished.