blob: 3b203cacd1633da43071ceceab4e0dcc31191de4 (
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(Vector2I offset) : base(offset)
{
}
public override void Perform(Game game, Actor actor)
{
Vector2I finalDestination = actor.GridPosition + Offset;
if (!game.Map.IsTileWalkable(finalDestination)) return;
if (game.Map.GetBlockingActorAtPosition(finalDestination) != null) return;
actor.Walk(Offset);
}
}
|