blob: 6fa3491f4e43adfc5be25d1fa3b1d0d60a21295b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
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;
if (game.Map.GetBlockingActorAtPosition(finalDestination) != null) return;
actor.Walk(Offset);
}
}
|