summaryrefslogtreecommitdiff
path: root/scripts/actors/actions/MovementAction.cs
blob: 54bb99c67e6ab9b4870db861d8f348df6daa02e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using Godot;
using System;

public partial class MovementAction : DirectionalAction
{
	public MovementAction(Actor actor, Vector2I offset) : base(actor, offset)
	{
	}

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

		if (!Map_Data.IsTileWalkable(finalDestination)) return;

		if (GetBlockingActorAtPosition(finalDestination) != null) return;

		actor.Walk(Offset);
	}
}