private Action CreateMoveAction(Direction direction) { GridInformation info = GridInformation.Invalid; Action action = null; Location loc = null; loc = direction.ApplyTo (base.Location); if (loc != null) { info = loc.GridInformation; } switch (info) { case GridInformation.Invalid: Messages.Instance.Add ("You can't go that way!"); break; case GridInformation.BlockingTerrain: Messages.Instance.Add ("There is something in the way."); break; case GridInformation.Occupied: AddAction (new AttackAction (this, loc.Actor)); break; default: action = new MoveAction (this, direction); break; } return action; }
public MoveAction(Actor actor, Direction direction) : base(actor) { this.direction = direction; }
public MoveAction(Actor actor) : base(actor) { this.direction = Direction.None; }
public bool CanMoveIn(Direction direction) { return CanMoveTo (direction.ApplyTo (base.Location)); }