public CardBehaviour GetHint2() { //first // TODO: Create the param will be returned. HintValueDisplay paramReturn = new HintValueDisplay(); // ============================================ LAST CARD FROM B ==================================== // // TODO: Get the last cards. CardBehaviour lastCard = HintZone.Instance.GetTheLastCard(Enums.IdTransformCard.TransformCards_B); var isReadyToJoin = false; // TODO: Get the target position. var positionTarget = Contains.Vector3Zero; // ============================================ DOING LAST CARD WITH RESULT ZONE ==================== // if (!object.ReferenceEquals(lastCard, null)) { // TODO: Get the list of id. var zoneCards = ResultZone.Instance.GetTheListIdZones(); // TODO: Get the cache of card from Result zone. CardBehaviour cardParamFromResultZone = null; for (int i = 0; i < zoneCards.Count; i++) { // TODO: Get the last card in playing zone. cardParamFromResultZone = ResultZone.Instance.GetTheLastCard((Enums.IdTransformCard)zoneCards[i]); // TODO: Get the condition null. if (!object.ReferenceEquals(cardParamFromResultZone, null)) { // TODO: Check the condition to join. if (lastCard.IsReadyToJoinZone(cardParamFromResultZone.GetProperties(), true)) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = cardParamFromResultZone.TargetPosition; return(lastCard); break; } } else { if (lastCard.GetValue() == (int)Enums.CardVariables.One) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = Helper.GetPositionInTheResultZone((Enums.IdTransformCard)zoneCards[i], Enums.Direction.None, true); return(lastCard); break; } } } } // =========================================== DOING LAST CARD WITH PLAYING ZONE ==================== // if (!object.ReferenceEquals(lastCard, null) && isReadyToJoin == false) { // TODO: Get the list of cards. var zoneCards = PlayingZone.Instance.GetTheListIdZones(); // TODO: Get the cache of card from playing zone. CardBehaviour cardParamFromPlayingZone = null; for (int i = 0; i < zoneCards.Count; i++) { // TODO: Get the last card in playing zone. cardParamFromPlayingZone = PlayingZone.Instance.GetTheLastCard((Enums.IdTransformCard)zoneCards[i]); // TODO: Get the condition null. if (!object.ReferenceEquals(cardParamFromPlayingZone, null)) { // TODO: Check the condition to join. if (lastCard.IsReadyToJoinZone(cardParamFromPlayingZone.GetProperties(), false, GameManager.Instance.GetModeGame() == Enums.ModeGame.Easy)) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = cardParamFromPlayingZone.TargetPosition; return(lastCard); break; } } else { if (lastCard.GetValue() == (int)Enums.CardVariables.King) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = Helper.GetPositionInThePlayingZone((Enums.IdTransformCard)zoneCards[i], Enums.Direction.None, true); return(lastCard); break; } } } } // ============================================ LAST CARD FROM A ==================================== // //---------------------------------------------------------------------------------- // TODO: Create the param will be returned. paramReturn = new HintValueDisplay(); // ============================================ LAST CARD FROM B ==================================== // lastCard = HintZone.Instance.GetTheLastCard(Enums.IdTransformCard.TransformCards_B); // TODO: Get the last cards. var arrayCards = HintZone.Instance.GetTheListCards(Enums.IdTransformCard.TransformCards_A); foreach (CardBehaviour card in arrayCards) { lastCard = card; isReadyToJoin = false; // TODO: Get the target position. positionTarget = Contains.Vector3Zero; // ============================================ DOING LAST CARD WITH RESULT ZONE ==================== // if (!object.ReferenceEquals(lastCard, null)) { // TODO: Get the list of id. var zoneCards = ResultZone.Instance.GetTheListIdZones(); // TODO: Get the cache of card from Result zone. CardBehaviour cardParamFromResultZone = null; for (int i = 0; i < zoneCards.Count; i++) { // TODO: Get the last card in playing zone. cardParamFromResultZone = ResultZone.Instance.GetTheLastCard((Enums.IdTransformCard)zoneCards[i]); // TODO: Get the condition null. if (!object.ReferenceEquals(cardParamFromResultZone, null)) { // TODO: Check the condition to join. if (lastCard.IsReadyToJoinZone(cardParamFromResultZone.GetProperties(), true)) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = cardParamFromResultZone.TargetPosition; return(lastCard); break; } } else { if (lastCard.GetValue() == (int)Enums.CardVariables.One) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = Helper.GetPositionInTheResultZone((Enums.IdTransformCard)zoneCards[i], Enums.Direction.None, true); return(lastCard); break; } } } } // =========================================== DOING LAST CARD WITH PLAYING ZONE ==================== // if (!object.ReferenceEquals(lastCard, null) && isReadyToJoin == false) { // TODO: Get the list of cards. var zoneCards = PlayingZone.Instance.GetTheListIdZones(); // TODO: Get the cache of card from playing zone. CardBehaviour cardParamFromPlayingZone = null; for (int i = 0; i < zoneCards.Count; i++) { // TODO: Get the last card in playing zone. cardParamFromPlayingZone = PlayingZone.Instance.GetTheLastCard((Enums.IdTransformCard)zoneCards[i]); // TODO: Get the condition null. if (!object.ReferenceEquals(cardParamFromPlayingZone, null)) { // TODO: Check the condition to join. if (lastCard.IsReadyToJoinZone(cardParamFromPlayingZone.GetProperties(), false, GameManager.Instance.GetModeGame() == Enums.ModeGame.Easy)) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = cardParamFromPlayingZone.TargetPosition; return(lastCard); break; } } else { if (lastCard.GetValue() == (int)Enums.CardVariables.King) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = Helper.GetPositionInThePlayingZone((Enums.IdTransformCard)zoneCards[i], Enums.Direction.None, true); return(lastCard); break; } } } } // ============================================ LAST CARD FROM A ==================================== // } arrayCards = HintZone.Instance.GetTheListCards(Enums.IdTransformCard.TransformCards_B); foreach (CardBehaviour card in arrayCards) { lastCard = card; isReadyToJoin = false; // TODO: Get the target position. positionTarget = Contains.Vector3Zero; // ============================================ DOING LAST CARD WITH RESULT ZONE ==================== // if (!object.ReferenceEquals(lastCard, null)) { // TODO: Get the list of id. var zoneCards = ResultZone.Instance.GetTheListIdZones(); // TODO: Get the cache of card from Result zone. CardBehaviour cardParamFromResultZone = null; for (int i = 0; i < zoneCards.Count; i++) { // TODO: Get the last card in playing zone. cardParamFromResultZone = ResultZone.Instance.GetTheLastCard((Enums.IdTransformCard)zoneCards[i]); // TODO: Get the condition null. if (!object.ReferenceEquals(cardParamFromResultZone, null)) { // TODO: Check the condition to join. if (lastCard.IsReadyToJoinZone(cardParamFromResultZone.GetProperties(), true)) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = cardParamFromResultZone.TargetPosition; return(lastCard); break; } } else { if (lastCard.GetValue() == (int)Enums.CardVariables.One) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = Helper.GetPositionInTheResultZone((Enums.IdTransformCard)zoneCards[i], Enums.Direction.None, true); return(lastCard); break; } } } } // =========================================== DOING LAST CARD WITH PLAYING ZONE ==================== // if (!object.ReferenceEquals(lastCard, null) && isReadyToJoin == false) { // TODO: Get the list of cards. var zoneCards = PlayingZone.Instance.GetTheListIdZones(); // TODO: Get the cache of card from playing zone. CardBehaviour cardParamFromPlayingZone = null; for (int i = 0; i < zoneCards.Count; i++) { // TODO: Get the last card in playing zone. cardParamFromPlayingZone = PlayingZone.Instance.GetTheLastCard((Enums.IdTransformCard)zoneCards[i]); // TODO: Get the condition null. if (!object.ReferenceEquals(cardParamFromPlayingZone, null)) { // TODO: Check the condition to join. if (lastCard.IsReadyToJoinZone(cardParamFromPlayingZone.GetProperties(), false, GameManager.Instance.GetModeGame() == Enums.ModeGame.Easy)) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = cardParamFromPlayingZone.TargetPosition; return(lastCard); break; } } else { if (lastCard.GetValue() == (int)Enums.CardVariables.King) { isReadyToJoin = true; // TODO: Get the default position. positionTarget = Helper.GetPositionInThePlayingZone((Enums.IdTransformCard)zoneCards[i], Enums.Direction.None, true); return(lastCard); break; } } } } // ============================================ LAST CARD FROM A ==================================== // } return(null); }
public bool DoCheckPlayingZone(bool IsMoving = true) { // TODO: Get the zone of card. List <int> paramGet = new List <int>(); // TODO: Check if this moving. if (IsMoving) { // TODO: Get the zone's id near this. paramGet.AddRange(PlayingZone.Instance.GetTheIdZonesMovingInside(card.transform.position)); } else { // TODO: Get all id of zones. paramGet.AddRange(PlayingZone.Instance.GetTheListIdZones()); } // TODO: Get the old zone. var zoneOld = PlayingZone.Instance.GetIdTransform(card); for (int i = 0; i < paramGet.Count; i++) { // TODO: Get the zone of card. Enums.IdTransformCard zoneGet = (Enums.IdTransformCard)paramGet[i]; // TODO: Create the point to check ready to join. var IsReadyToJoin = false; // TODO: Check if this zone is not none. if (zoneGet != Enums.IdTransformCard.None && zoneOld != zoneGet) { // TODO: Get the card. card.TargetBehaviour = PlayingZone.Instance.GetTheLastCard(zoneGet); // TODO: Check if this card is not null. if (!object.ReferenceEquals(card.TargetBehaviour, null)) { // TODO: Check if this card can join with this zone. if (card.IsReadyToJoinZone(card.TargetBehaviour.GetProperties())) { // TODO: Set ready. IsReadyToJoin = true; } } else { if (IsMoving == false && i == 0) { // TODO: Set not ready. IsReadyToJoin = false; } else { // TODO: Set ready. IsReadyToJoin = true; } } // TODO: Check if ready to join. if (IsReadyToJoin) { // TODO: Record Data. UndoSystem.Instance.Record(Enums.Zone.Play, zoneOld, card, card.IsUnlocked()); // TODO: Get the list cards. var cardsFollow = HelperZone.Instance.GetListCards(); for (int j = cardsFollow.Count - 1; j > -1; j--) { // TODO: Record datas. UndoSystem.Instance.Record(Enums.Zone.Play, zoneOld, cardsFollow[j], cardsFollow[j].IsUnlocked(), true); } // TODO: Remove this card. PlayingZone.Instance.RemoveTheCard(zoneOld, card); // TODO: Get the new position need to moving. card.TargetPosition = Helper.GetPositionInThePlayingZone(zoneGet, Enums.Direction.Down, card.IsUnlocked()); // TODO: Moving to the new position. card.Moving(card.TargetPosition, () => { // TODO: Set the new of parent. card.transform.SetParent(PlayingZone.Instance.GetTransformCards(zoneGet)); // TODO: Sort this card in the view. card.transform.SetAsLastSibling(); // TODO: Reset all the card follow. card.DistributeTheFollowCards(); // TODO: Check the completed of a zone. if (!PlayingZone.Instance.DoCompletedAListCards(zoneGet)) { // TODO: Unlocking the last card. PlayingZone.Instance.UnlockLastCard(); // TODO: Update the state of all cards. PlayingZone.Instance.UpdateTheStateCardsInZone(zoneGet); } // TODO: Update the state of cards. PlayingZone.Instance.UpdateTheStateCardsInZone(zoneOld); }); // TODO: Add this card to the new zone. PlayingZone.Instance.AddTheCard(zoneGet, card); // TODO: Break the functions. return(true); } } } return(false); }
protected bool DoCheckResultZone(bool IsMoving = true) { // TODO: Check start with point. int IsCardsFromTheCheckPoint = (int)Enums.Zone.None; // TODO: Get the id zone from old. var zoneOld = ResultZone.Instance.GetIdTransform(card); if (zoneOld == Enums.IdTransformCard.None) { // TODO: Get zone from hint zone. zoneOld = HintZone.Instance.GetIdTransform(card); if (zoneOld != Enums.IdTransformCard.None) { //TODO: Record the zone. IsCardsFromTheCheckPoint = (int)Enums.Zone.Hint; } else { zoneOld = PlayingZone.Instance.GetIdTransform(card); if (zoneOld != Enums.IdTransformCard.None) { IsCardsFromTheCheckPoint = (int)Enums.Zone.Play; } } } else { //TODO: Record the zone. IsCardsFromTheCheckPoint = (int)Enums.Zone.Result; } if (IsCardsFromTheCheckPoint == (int)Enums.Zone.Play) { if (HelperZone.Instance.GetCountCards() > 0) { // TODO: Break the function. return(false); } } // TODO: Get the card find. CardBehaviour cardFind = null; // TODO: Get the zone of card. List <int> paramGet = new List <int>(); // TODO: Check if this moving. if (IsMoving) { // TODO: Get the zone's id near this. paramGet.AddRange(ResultZone.Instance.GetTheIdZonesMovingInside(card.transform.position)); } else { // TODO: Get all id of zones. paramGet.AddRange(ResultZone.Instance.GetTheListIdZones()); } // TODO: Loop to get the best zone. for (int i = 0; i < paramGet.Count; i++) { // TODO: Get the zone of card. Enums.IdTransformCard zoneGet = (Enums.IdTransformCard)paramGet[i]; // TODO: Create the point to check ready to join. var IsReadyToJoin = false; // TODO: Check if this zone is not none. if (zoneGet != Enums.IdTransformCard.None && (IsCardsFromTheCheckPoint == (int)Enums.Zone.Result && zoneOld != zoneGet || IsCardsFromTheCheckPoint != (int)Enums.Zone.Result)) { // TODO: Get the card. card.TargetBehaviour = ResultZone.Instance.GetTheLastCard(zoneGet); // TODO: Check if this card is not null. if (!object.ReferenceEquals(card.TargetBehaviour, null)) { // TODO: Check if this card can join with this zone. if (card.IsReadyToJoinZone(card.TargetBehaviour.GetProperties(), true)) { // TODO: Set ready. IsReadyToJoin = true; } } else { if (card.GetValue() == (int)Enums.CardVariables.One) { // TODO: Set ready. IsReadyToJoin = true; } else { IsReadyToJoin = false; } } } // TODO: The condition free not none. if (IsReadyToJoin) { switch (IsCardsFromTheCheckPoint) { case (int)Enums.Zone.Hint: // TODO: Record Data. UndoSystem.Instance.Record(Enums.Zone.Hint, zoneOld, card, card.IsUnlocked()); break; case (int)Enums.Zone.Result: // TODO: Record Data. UndoSystem.Instance.Record(Enums.Zone.Result, zoneOld, card, card.IsUnlocked()); break; case (int)Enums.Zone.Play: // TODO: Record Data. UndoSystem.Instance.Record(Enums.Zone.Play, zoneOld, card, card.IsUnlocked()); break; } // TODO: Get the new position need to moving. card.TargetPosition = Helper.GetPositionInTheResultZone(zoneGet, Enums.Direction.None, card.IsUnlocked()); // TODO: Moving to the new position. card.Moving(card.TargetPosition, () => { // TODO: Set the new of parent. card.transform.SetParent(ResultZone.Instance.GetTransformCards(zoneGet)); // TODO: Sort this card in the view. card.transform.SetAsLastSibling(); if (IsCardsFromTheCheckPoint != (int)Enums.Zone.Result && IsCardsFromTheCheckPoint != (int)Enums.Zone.None) { // TODO: Get the pool. var objectEmptyThing = PoolSystem.Instance.GetFromPool(Enums.PoolType.PExploise); if (!object.ReferenceEquals(objectEmptyThing, null)) { // TODO: Enable the gameobject. objectEmptyThing.gameObject.SetActive(true); // TODO: Set the position. objectEmptyThing.transform.position = card.TargetPosition; } var textThing = PoolSystem.Instance.GetFromPool(Enums.PoolType.TColorText); if (!object.ReferenceEquals(textThing, null)) { // TODO: Set the position. textThing.transform.position = card.TargetPosition; // TODO: Get the script. var scriptFind = textThing.GetComponent <TScoreDisplay>(); // TODO: Check the condition to show. if (!object.ReferenceEquals(scriptFind, null)) { Helper.StringBulding.Clear(); // TODO: Append the string. Helper.StringBulding.Append(Contains.ScoreResultCards + Contains.ScoreResultCards * HelperZone.Instance.GetCountCards()); // TODO: Display the score. scriptFind.Show(Helper.StringBulding.ToString()); // TODO: Enable the gameobject. textThing.gameObject.SetActive(true); } } // TODO: Update the score. Contains.Score += Contains.ScoreResultCards + Contains.ScoreResultCards * HelperZone.Instance.GetCountCards(); // TODO: Update display score. UIBehaviours.Instance.UpdateScore(); } // TODO: Unlocking the last card. PlayingZone.Instance.UnlockLastCard(); // TODO: Update the state of all cards. PlayingZone.Instance.UpdateTheStateCardsInZone(zoneOld); }); switch (IsCardsFromTheCheckPoint) { case (int)Enums.Zone.Hint: // TODO: Remove this card from zone old. HintZone.Instance.RemoveTheCard(zoneOld, card); // TODO: Sort the cards of hint zone. Helper.SortCards(HintZone.Instance.GetTheListCards(Enums.IdTransformCard.TransformCards_B), Enums.Direction.Right, HintZone.Instance.GetDefaultPosition(Enums.IdTransformCard.TransformCards_B), 3); break; case (int)Enums.Zone.Result: // TODO: Remove this card. ResultZone.Instance.RemoveTheCard(zoneOld, card); break; case (int)Enums.Zone.Play: // TODO: Remove from zone old. PlayingZone.Instance.RemoveTheCard(zoneOld, card); break; } // TODO: Add this card to the new zone. ResultZone.Instance.AddTheCard(zoneGet, card); return(true); } } // TODO: Break the function. return(false); }