public HintValueDisplay GetHint() { // TODO: Create the list will be returned. HintValueDisplay paramOut = new HintValueDisplay(); // TODO: Create the lenght of cards. int lenght = PlayingZone.Instance.zoneCards.Length; // TODO: Create the flag, the condition to check moving cards. bool IsReadyToCheck = false; // TODO: Loop to check. for ( int i = 0; i < lenght; i++ ) { // TODO: the condition to break the function. if (IsReadyToCheck) { // TODO: Break the function. break; } // TODO: Create the cache to check the cards. var paramCheck = new List<CardBehaviour>(PlayingZone.Instance.GetTheListCards(PlayingZone.Instance.zoneCards[i].Id)); // TODO: Check if the list cards is empty or null. if ( object.ReferenceEquals ( paramCheck , null ) || paramCheck.Count == 0) { // TODO: next to another. continue; } // TODO: Create the count of list. int count = paramCheck.Count; // ====================================== DOING HINT WITH RESULT ZONE =================================== // if (count > 0) { // 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 j = 0; j < zoneCards.Count; j++) { // TODO: Get the last card in playing zone. cardParamFromResultZone = ResultZone.Instance.GetTheLastCard ((Enums.IdTransformCard)zoneCards [j]); // TODO: Get the condition null. if (!object.ReferenceEquals (cardParamFromResultZone, null)) { // TODO: Check the condition to join. if (paramCheck [count - 1].IsReadyToJoinZone (cardParamFromResultZone.GetProperties (), true)) { // TODO: Set the card will be displayed. paramOut.cardDisplay = paramCheck [count - 1]; // TODO: Get the new position need to moving. paramOut.positionTarget = cardParamFromResultZone.TargetPosition; // TODO: Return the value. return paramOut; } } else { if (paramCheck [count - 1].GetValue () == (int)Enums.CardVariables.One) { // TODO: Set the card will be displayed. paramOut.cardDisplay = paramCheck [count - 1]; // TODO: Get the new position need to moving. paramOut.positionTarget = Helper.GetPositionInTheResultZone ((Enums.IdTransformCard)zoneCards [j] , Enums.Direction.None , true ); // TODO: Return the value. return paramOut; } } } } // ====================================== DOING HINT WITH PLAYING ZONE =================================== // // TODO: Loop to get the cards. for ( int j = 0; j < count ; j ++ ) { // TODO: the condition to break the function. if (IsReadyToCheck) { // TODO: Break the function. break; } // TODO: Create the cache of cards. var cardParam = paramCheck[j]; // TODO: Check if the card is lock break. if (cardParam.IsUnlocked() == false || cardParam.GetStateCard() != Enums.StateCard.None) { continue; } for ( int h = 0; h < lenght; h++ ) { // TODO: Check if id is the same. if ( PlayingZone.Instance.zoneCards[h].Id == PlayingZone.Instance.zoneCards[i].Id) { continue; } // TODO: the condition to join. var IsReadyToJoin = false; // TODO: Get the card. var TargetBehaviour = PlayingZone.Instance.GetTheLastCard(PlayingZone.Instance.zoneCards[h].Id); // TODO: Check if this card is not null. if (!object.ReferenceEquals(TargetBehaviour, null)) { // TODO: Check if this card can join with this zone. if (cardParam.IsReadyToJoinZone (TargetBehaviour.GetProperties (), false , GameManager.Instance.GetModeGame() == Enums.ModeGame.Easy )) { // TODO: Set ready. IsReadyToJoin = true; } } else { if (cardParam.GetValue () == (int)Enums.CardVariables.King && !object.ReferenceEquals ( PlayingZone.Instance.GetTheFirstCard (cardParam) , cardParam)) { // TODO: Set ready. IsReadyToJoin = true; } else { IsReadyToJoin = false; } } if ( IsReadyToJoin ) { // TODO: Set the card will be displayed. paramOut.cardDisplay = cardParam; // TODO: Get the new position need to moving. paramOut.positionTarget = Helper.GetPositionInThePlayingZone( PlayingZone.Instance.zoneCards[h].Id, Enums.Direction.Down, cardParam.IsUnlocked()); // TODO: Break the flags. IsReadyToCheck = true; // TODO: Break the function. break; } } // TODO: Break the function. break; } } // TODO: Return the list. return paramOut; }
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); }