public static void UndoSwap(Action callBack) { MatchObject dM = Source.Match; MatchObject tM = Target.Match; Source.GrabDynamicObject(tM.gameObject, false, null); Target.GrabDynamicObject(dM.gameObject, false, () => { callBack?.Invoke(); }); }
public static void Swap(GridCell gc1, GridCell gc2) { Source = gc1; Target = gc2; if (Source && Source.CanSwap(Target)) { SwapBeginEvent?.Invoke(Target); MatchObject dM = Source.Match; MatchObject tM = Target.Match; dM.SwapTime = Time.time; tM.SwapTime = Time.time; Source.GrabDynamicObject(tM.gameObject, false, null); Target.GrabDynamicObject(dM.gameObject, false, () => { SwapEndEvent?.Invoke(Target); }); } else if (Source) { Touch.ResetDrag(null); } }