BumpAttack
namespace Griff.Scenes;
public sealed class BumpAttack : ComponentA roguelike’s attack, with no code: its GridMovement stepping into something with Health on its Layers hurts it by Damage instead of bumping, with a lunge toward it and back over a step’s time. Holding the way keeps hitting. On a player it attacks the monsters it walks into; on a monster with a GridChase whose Stop Distance is 0, it attacks the player it walks into.
Taking turns, each hit uses an action, as a step does. A Health with an Invincible Time ignores hits while it lasts: 0 lets each step’s hit land. In a network game the host does the damage.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”Damage
Section titled “Damage”public float Damage { get; set; }Hit points each hit takes away.
DamageRoll
Section titled “DamageRoll”public string? DamageRoll { get; set; }Dice rolled for each hit’s damage in place of Damage, e.g. “1d8+2”; empty hits for Damage every time. Table Values sets it from a dice column given for Damage.
Effect
Section titled “Effect”public string? Effect { get; set; }A prefab spawned on what it hits, e.g. “Sparkle”: a burst of particles, a damage number.
HitStop
Section titled “HitStop”public float HitStop { get; set; }Freezes the game for this many seconds when a hit lands, so it hits hard. 0 for none.
Layers
Section titled “Layers”public string? Layers { get; set; }The collision layers it hurts, e.g. “Enemy” (or “Player” for a monster). Empty hurts anything with health.
public string? Sound { get; set; }A sound played with each hit, e.g. “Sounds/hit.wav”.
Methods
Section titled “Methods”public bool Hurts(string? layer)True if it hurts things on collision layer layer.
RollDamage
Section titled “RollDamage”public float RollDamage()The damage of one hit: DamageRoll rolled, or Damage.
Events
Section titled “Events”public event Action<Entity>? HitRaised with each hit, with what it hit.