public override IEnumerator Execute(Board board, Lock locker = null) { if (locker != null) { locker.SignalStart(); } if (info.targetId != World.InvalidId && info.originId != World.InvalidId) { GridObject target = board.GridObjectById(info.targetId); // Make target blink and wait for it to finish. target.Animate(new Blinker(), Colors.movementActionColor, true); while (target.IsAnimating()) { yield return(null); } board.MoveObject(target, movement); } else { Debug.LogError("Invalid info provided to MoveAction!"); } if (locker != null) { locker.SignalStop(); } yield return(null); }
public override IEnumerator Execute(Board board, Lock locker = null) { if (locker != null) { locker.SignalStart(); } if (info.targetId != World.InvalidId && info.targetId != World.InvalidId) { GridObject origin = board.GridObjectById(info.originId); GridObject target = board.GridObjectById(info.targetId); // Make origin blink and wait for it to finish. origin.Animate(new Blinker(), Colors.movementActionColor, true); while (origin.IsAnimating()) { yield return(null); } // Make target blink and wait for it to finish. target.Animate(new Blinker(), Colors.movementActionColor, true); while (target.IsAnimating()) { yield return(null); } board.SwapObjects(origin, target); board.world.DamageIntegrity(0.5f); board.world.manager.audioPlayer.PlaySound("ActionSound", 0.5f); } else { Debug.LogError("Invalid info provided to Swapaction"); } if (locker != null) { locker.SignalStop(); } yield return(null); }