예제 #1
0
        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);
            }
        }