summaryrefslogtreecommitdiff
path: root/scripts/actors/actions/BumpAction.cs
blob: e1fb7064c9466bd75b48dd6e7034b890fcadcf13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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);
	}
}