Skip to content

Fighter

namespace Griff.Modules.Strategy;
public sealed class Fighter : Component

Fights for a Unit or a Building (a tower): it attacks enemies that come within its unit’s sight on its own, and whatever it’s told to. Up close it hits straight away; with a Projectile it fires one that flies to the target and hurts it on arrival.

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

public float Cooldown { get; set; }

Seconds between hits.

public float Damage { get; set; }

Hit points each hit takes off the target’s Health.

public string? Projectile { get; set; }

A prefab it fires at the target, e.g. “Arrow”. Empty hits straight away.

public float ProjectileSpeed { get; set; }

How fast its projectile flies, in world units per second.

public float Range { get; set; }

How close it has to be to hit, from its edge to the target’s, in world units.

public string? Sound { get; set; }

A sound played with each hit or shot, e.g. “Sounds/swing.wav”.

public Entity? Target { get; }

The enemy it’s hitting, if any.

public event Action<Entity>? Swung

Raised with each hit or shot, with its target.