Skip to content

TacticsControls

namespace Griff.Modules.Tactics;
public sealed class TacticsControls : Component, IPlaytestReport

Lets players command their TacticsUnits with the mouse, or with a cursor moved by the arrow keys or the stick: click one of your units whose team’s turn it is to pick it, and the cells it can walk to light up in MoveColor, with the cells it can hit from them in AttackColor; hover a cell to see the way it would go. Click a lit cell to walk there, then an enemy in reach to attack it (or click an enemy straight away to walk up and hit it), or the unit itself to wait. Right-click (or Cancel) puts it back or lets it go. Hovering any unit shows how far it reaches. Units that have had their go are dimmed. On the computer’s turn, each of its units’ reach lights up for ComputerPause before it moves.

One per scene (the first with focus is used); it draws nothing itself. In a network game each player picks on their own screen.

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

public Color AttackColor { get; set; }

The cells it can hit from them, and what it can attack.

public string? CancelAction { get; set; }

The input action that puts a unit back or lets it go, as a right click does: “Dash” is Shift or the gamepad’s B.

public string? CancelSound { get; set; }

A sound played on letting a unit go or putting it back.

public float ComputerPause { get; set; }

Seconds the computer takes over each of its units’ goes before it moves, while the unit’s reach lights up, so you can follow what it does.

public string? ConfirmAction { get; set; }

The input action that picks or goes to the cell under the cursor, as a left click does: “Jump” is Space or the gamepad’s A.

public bool Controllable { get; set; }

Untick it to have the controls ignore the mouse, keys and gamepad (the computer’s turns still play): another part of the scene has the player’s input. Its Focus action ticks it and unticks it on everything else the player plays, and another’s Focus takes it back.

public ValueTuple<int, int>? Cursor { get; }

The cell under the cursor (column then row on the units’ map), or null when it’s off the map.

public Color CursorColor { get; set; }

The outline round the cell under the cursor.

public Color DoneTint { get; set; }

Multiplies the color of units that have had their go.

public bool HealthBars { get; set; }

Draws a health bar under each unit with Health.

public Color MoveColor { get; set; }

The cells a picked unit can walk to.

public Color PathColor { get; set; }

The way it would walk to the hovered cell.

public string? SelectSound { get; set; }

A sound played on picking a unit, e.g. “Sounds/select.wav”.

public Entity? Selected { get; set; }

The unit picked on this screen, or null. Set it from a script to pick one.

public bool ShowOnHover { get; set; }

Hovering a unit nobody has picked shows how far it can walk and hit, fainter.

public event Action<Entity>? Picked

Raised when a unit is picked, with it.