private void FinishHintAnim() { dimScreen.MakeScreenLight(); BoardManager.instance.UnlockBoard(); isInHintMode = false; animationQueueController.CastNextAnimation(); }
private void ReturnCardsFromWasteToStock() { stockLimit--; MatchStatistics.instance.moves--; if (MatchStatistics.instance.IsVegasGame() && stockLimit <= 0) { stockLimit = 0; RefreshStockState(false); SaveManager.instance.RemoveLastSave(); animationQueueController.CastNextAnimation(); } else { int childCount = waste.transform.childCount; wasteOrderList.Clear(); if (childCount > 0) { SoundManager.instance.PlayPickCardSound(); noOfAnimations = childCount; animationQueueController.SetAnimationStatus(AnimationStatus.inProgress); sortStock = true; } for (int i = 0; i < childCount; i++) { Transform child = waste.transform.GetChild(0); wasteOrderList.Add(child); Card card = child.GetComponent <Card>(); card.transform.SetParent(transform.parent); card.SetReturnPoint(transform, Constants.vectorZero); card.RegisterOnReverseAnimationFinishCB(FinishReturnWasteAnimation); noOfAnimations++; card.RotateCard(Constants.STOCK_ANIM_TIME); card.RegisterOnAnimationFinishCB(FinishReturnWasteAnimation); card.MoveCard(Constants.STOCK_ANIM_TIME * 2); } if (childCount == 0) { animationQueueController.CastNextAnimation(); RefreshStockState(false); SaveManager.instance.RemoveLastSave(); } } }
private void Undo() { noOfAnimations = 0; waste.RegisterOnRefreshWasteAction(null); allMovesSet = false; animationQueueController.SetAnimationStatus(AnimationStatus.inProgress); if (saveList.Count > 0) { cardsToAnimate.Clear(); cardsToRotate.Clear(); SaveState lastSave = saveList[saveList.Count - 1]; MatchStatistics.instance.score = lastSave.score; MatchStatistics.instance.moves = lastSave.moves; MatchStatistics.instance.vegasScore = lastSave.vegasScore; stock.stockLimit = lastSave.stockLimit; for (int i = 0; i < lastSave.cardsInfo.Count; i++) { Card myCard = gameCardsSet[i]; CardInfo myCardInfo = lastSave.cardsInfo[myCard]; myCard.gameObject.SetActive(true); CheckIfCardNeedRotateAnim(myCard, myCardInfo); //trasfrom local position to world pos Vector3 prevPos = myCardInfo.GetParent().TransformPoint(myCardInfo.GetPos()); //if card change position play anim if (myCard.transform.parent != myCardInfo.GetParent()) { if (cardsToAnimate.ContainsKey(myCard)) { Debug.LogError("Dictionary has already key " + myCard.name); } else { myCard.lastGoodParametres.lastCardAbove = myCardInfo.GetCardAbove(); myCard.SetReturnPoint(myCardInfo.GetParent(), prevPos - myCardInfo.GetParent().position); cardsToAnimate.Add(myCard, myCardInfo); } } else { myCard.transform.SetParent(myCardInfo.GetParent(), true); myCard.transform.position = new Vector3(myCard.transform.position.x, prevPos.y, myCard.transform.position.z); } myCard.transform.parent.SendMessage("RefreshZone", SendMessageOptions.DontRequireReceiver); } saveList.Remove(lastSave); AnimCards(); stock.RefreshStockState(lastSave.stockState, false); } else { Debug.Log("No moves to undo"); animationQueueController.CastNextAnimation(); } allMovesSet = true; }