TacticsControls
namespace Griff.Modules.Tactics;
public sealed class TacticsControls : Component, IPlaytestReportLets 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.
Properties
Section titled “Properties”AttackColor
Section titled “AttackColor”public Color AttackColor { get; set; }The cells it can hit from them, and what it can attack.
CancelAction
Section titled “CancelAction”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.
CancelSound
Section titled “CancelSound”public string? CancelSound { get; set; }A sound played on letting a unit go or putting it back.
ComputerPause
Section titled “ComputerPause”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.
ConfirmAction
Section titled “ConfirmAction”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.
Controllable
Section titled “Controllable”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.
Cursor
Section titled “Cursor”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.
CursorColor
Section titled “CursorColor”public Color CursorColor { get; set; }The outline round the cell under the cursor.
DoneTint
Section titled “DoneTint”public Color DoneTint { get; set; }Multiplies the color of units that have had their go.
HealthBars
Section titled “HealthBars”public bool HealthBars { get; set; }Draws a health bar under each unit with Health.
MoveColor
Section titled “MoveColor”public Color MoveColor { get; set; }The cells a picked unit can walk to.
PathColor
Section titled “PathColor”public Color PathColor { get; set; }The way it would walk to the hovered cell.
SelectSound
Section titled “SelectSound”public string? SelectSound { get; set; }A sound played on picking a unit, e.g. “Sounds/select.wav”.
Selected
Section titled “Selected”public Entity? Selected { get; set; }The unit picked on this screen, or null. Set it from a script to pick one.
ShowOnHover
Section titled “ShowOnHover”public bool ShowOnHover { get; set; }Hovering a unit nobody has picked shows how far it can walk and hit, fainter.
Events
Section titled “Events”Picked
Section titled “Picked”public event Action<Entity>? PickedRaised when a unit is picked, with it.