summaryrefslogtreecommitdiff
path: root/scripts/actors/actions/BumpAction.cs
blob: 5958b1170ce6b54d14b4ed81cb12014d4803e699 (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(Actor actor, Vector2I offset) : base(actor, offset)
	{
	}

	public override void Perform()
	{
		Vector2I destination = actor.GridPosition + Offset;

		Action action;

		if (GetBlockingActorAtPosition(destination) != null) {
			action = new MeleeAction(actor, Offset);
		} else {
			action = new MovementAction(actor, Offset);
		}

		action.Perform();
	}
}