private bool PerformPickup(IAtlas atlas, ITilesetTable tilesetTable)
{
// check tile in front of
List<GameActorPosition> targets = GetInteractableTilesInFrontOf(atlas);
// if no tile, check objects
if (targets.Count == 0)
{
targets = GetInteractableObjectsInFrontOf(atlas);
}
if (targets.Count == 0) return false;
foreach (GameActorPosition target in targets)
{
IPickableGameActor interactableTarget = target.Actor as IPickableGameActor;
if (interactableTarget == null) continue;
GameAction pickUpAction = new PickUp(this);
interactableTarget.PickUp(atlas, pickUpAction, target.Position, tilesetTable);
RemoveSpeed(target);
return true;
}
return false;
}