diff options
| author | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-17 20:49:03 -0300 |
|---|---|---|
| committer | Matheus <matheus.guedes.mg.m@gmail.com> | 2025-08-17 20:49:03 -0300 |
| commit | bd8a14e5d22ee7e4e53a1b3c8bfe2b35328632e5 (patch) | |
| tree | c91a87d683884e468a8c4e2079dbf0d80b81396c /scripts/actors/actions/BumpAction.cs | |
| parent | bf74afcdd07e59b1a48dbfacdce9d52fad765865 (diff) | |
Attack
Diffstat (limited to 'scripts/actors/actions/BumpAction.cs')
| -rw-r--r-- | scripts/actors/actions/BumpAction.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/actors/actions/BumpAction.cs b/scripts/actors/actions/BumpAction.cs new file mode 100644 index 0000000..e1fb706 --- /dev/null +++ b/scripts/actors/actions/BumpAction.cs @@ -0,0 +1,24 @@ +using Godot; +using System; + +public partial class BumpAction : DirectionalAction +{ + public BumpAction(Vector2I offset) : base(offset) + { + } + + public override void Perform(Game game, Actor actor) + { + Vector2I destination = actor.GridPosition + Offset; + + Action action; + + if (game.Map.GetBlockingActorAtPosition(destination) != null) { + action = new MeleeAction(Offset); + } else { + action = new MovementAction(Offset); + } + + action.Perform(game, actor); + } +} |
