summaryrefslogtreecommitdiff
path: root/scripts/actors/actions/MovementAction.cs
blob: 8d864bded2603831585d6480cdabea2a0305f7dc (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 : Action
{
	public Vector2I Offset { get; private set; }
	public MovementAction(Vector2I offset)
	{
		Offset = offset;
	}

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

		if (!game.Map.IsTileWalkable(finalDestination)) return;

		actor.Walk(Offset);
	}
}