public void Swap(Coin c1, Coin c2) { if (Lines[c1.XPos] > 0 || Lines[c2.XPos] > 0) return; Vector3 pos1 = c1.transform.localPosition; Vector3 pos2 = c2.transform.localPosition; if (TrySwap(c1, c2)) { ApplySwap(c1, c2); print("create move coins"); c1.MoveToSpeedBased(pos2, 0, swapSpeed, ""); c2.MoveToSpeedBased(pos1, 0, swapSpeed, ""); } else { c1.MoveToSpeedBased(pos2, 0, swapSpeed, "failSwap"); c2.MoveToSpeedBased(pos1, 0, swapSpeed, "failSwap"); } }
public void OnMoveDone(Coin coin, string msg) { if (coin.State != eCoinState.Idle) return; Cell cell = GetCell(coin.PlaceId); cell.CoinRef = coin; if (msg == "failSwap") { coin.MoveToSpeedBased(coin.GetRealPosition(), 0, swapSpeed, "doneFailSwap"); } else if (msg != "doneFailSwap" && m_busy == 0) { CheckAll(0); } }