public override void Execute()
{
if(startTargetModel.targetingCard.isSpell) return;
var phantomPiece = pieces.Pieces.FirstOrDefault(p => p.tags.Contains(Constants.targetPieceTag));
if (phantomPiece != null)
{
//skip spawning if there's already the phantom piece out, like in a choose action
debug.Log("Phantom piece already spawned");
return;
}
var spawnedPiece = new SpawnPieceModel
{
cardTemplateId = startTargetModel.targetingCard.cardTemplateId,
pieceId = -1,
playerId = startTargetModel.targetingCard.playerId,
position = startTargetModel.cardDeployPosition.position.ToPositionModel(),
tags = new List<string>() { Constants.targetPieceTag },
direction = Direction.South
};
var pieceModel = pieceService.CreatePiece(spawnedPiece);
animationQueue.Add(new PieceView.SpawnAnim() {
piece = pieceModel.gameObject.GetComponent<PieceView>(),
map = map,
mapService = mapService
});
//Skip sending out the piece spawned signal since it hasn't actually properly been spawned yet
//pieceSpawned.Dispatch(pieceModel);
debug.Log("Spawned phantom target piece");
}