Beispiel #1
0
    /// <summary>
    /// Determines whether this instance is the latest card unlocked.
    /// </summary>
    public bool IsLastCardUnlocked(Enums.IdTransformCard id)
    {
        // TODO: Get the last cards in the list.
        CardBehaviour cardGet = GetTheLastCard(id);

        // TODO: Check if is null.
        if (object.ReferenceEquals(cardGet, null))
        {
            // TODO: Return false if is null.
            return(false);
        }

        // TODO: Return the state of the card.
        return(cardGet.IsUnlocked());
    }
Beispiel #2
0
        /// <summary>
        /// Unlocks the last card from all the arrays.
        /// </summary>
        public void UnlockLastCard()
        {
            // TODO: Create the value will be unlocked.
            CardBehaviour paramCheck = null;

            // TODO: Loop to check all the arrays.
            for (int i = 0; i < PlayingZone.Instance.zoneCards.Length; i++)
            {
                // TODO: Get the default of value.
                paramCheck = PlayingZone.Instance.GetTheLastCard(PlayingZone.Instance.zoneCards[i].Id);

                // TODO: Check it don't equal null.
                if (paramCheck != null)
                {
                    // TODO: Records Unlock
                    UndoSystem.Instance.Record(Enums.Zone.Play, Enums.IdTransformCard.None, paramCheck, paramCheck.IsUnlocked(), true);


                    // TODO: Unlock this cards.
                    paramCheck.Unlock(true);
                }
            }
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
        public bool DoCheckPlayingZone(bool IsMoving = true)
        {
            // TODO: Check the condition null.
            if (object.ReferenceEquals(GamePlay.Instance.cardSaveCache, null))
            {
                // TODO: Break the  function.
                return(false);
            }

            // TODO: Get the cache of card.
            var cardSave = GamePlay.Instance.cardSaveCache;

            bool IsReadyAnotherCondition = true;
            bool IsReadyKingCondition    = false;

            if (card.GetEnumsCard() == Enums.CardVariables.King && cardSave.GetEnumsCard() == Enums.CardVariables.One || card.GetEnumsCard() == Enums.CardVariables.One && cardSave.GetEnumsCard() == Enums.CardVariables.King)
            {
                // TODO: Set the another condition.
                IsReadyKingCondition = true;
            }

            switch (GameManager.Instance.GetModeGame())
            {
            case Enums.ModeGame.Hard:

                if (card.GetTypeCards() != cardSave.GetTypeCards())
                {
                    // TODO: Set the another condition.
                    IsReadyAnotherCondition = false;
                }

                break;

            case Enums.ModeGame.Medium:

                if (!card.IsSameColorCard(cardSave.GetTypeCards()))
                {
                    // TODO: Set the another condition.
                    IsReadyAnotherCondition = false;
                }

                break;
            }

            if ((cardSave.GetValue() + 1 == card.GetValue() || cardSave.GetValue() - 1 == card.GetValue()) && IsReadyAnotherCondition || IsReadyKingCondition && IsReadyAnotherCondition)
            {
                Enums.IdTransformCard previousId = PlayingZone.Instance.GetIdTransform(card);

                // TODO: Record undo.
                UndoSystem.Instance.Record(Enums.Zone.Play, PlayingZone.Instance.GetIdTransform(card), card, card.IsUnlocked());

                // TODO: Get the dafult transform from zone.
                Transform parentTransform = ResultZone.Instance.GetTransformCards(Enums.IdTransformCard.TransformCards_A);

                // TODO: Get the position of card from zone.
                var position = Helper.GetPositionInTheResultZone(Enums.IdTransformCard.TransformCards_A, Enums.Direction.None, true);

                // TODO: Set the target position x for the card.
                card.TargetPosition.x = position.x;

                // TODO: Set the target position y for the card.
                card.TargetPosition.y = position.y;

                // TODO: Set the target position z for the card.
                card.TargetPosition.z = position.z;
                //Debug.Log("--card.POSITION: " + card.transform.position);
                //Debug.Log("--card.TargetPosition: " + card.TargetPosition);
                // TODO: Moving the card to new position.
                card.Moving(card.TargetPosition, parentTransform, () => {
                    if (PlayingZone.Instance.IsEmptyCards(previousId))
                    {
                        Vector3 positionFind = PlayingZone.Instance.GetDefaultPosition(previousId);

                        // 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 = positionFind;
                        }

                        var textEmptyThing = PoolSystem.Instance.GetFromPool(Enums.PoolType.TColorText);

                        if (!object.ReferenceEquals(textEmptyThing, null))
                        {
                            // TODO: Set the position.
                            textEmptyThing.transform.position = positionFind;

                            // TODO: Get the script.
                            var scriptEmptyFind = textEmptyThing.GetComponent <TScoreDisplay>();

                            // TODO: Check the condition to show.
                            if (!object.ReferenceEquals(scriptEmptyFind, null))
                            {
                                // TODO: Display the score.
                                scriptEmptyFind.Show(Contains._ScoreResultClear);

                                // TODO: Enable the gameobject.
                                textEmptyThing.gameObject.SetActive(true);
                            }
                        }

                        // TODO: Update the score.
                        Contains.Score += Contains.ScoreResultClear;

                        // TODO: Play the completed sound.
                        SoundSystems.Instance.PlaySound(Enums.SoundIndex.Completed);
                    }

                    // TODO: Play the correct sound.
                    SoundSystems.Instance.PlaySound(Enums.SoundIndex.Correct);

                    // TODO: Get the pool.
                    var objectThing = PoolSystem.Instance.GetFromPool(Enums.PoolType.PExploise);

                    if (!object.ReferenceEquals(objectThing, null))
                    {
                        // TODO: Enable the gameobject.
                        objectThing.gameObject.SetActive(true);

                        // TODO: Set the position.
                        objectThing.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))
                        {
                            // TODO: Display the score.
                            scriptFind.Show(Contains._ScoreResultCards);

                            // TODO: Enable the gameobject.
                            textThing.gameObject.SetActive(true);
                        }
                    }

                    // TODO: Unlock the last card.
                    PlayingZone.Instance.UnlockLastCard();

                    // TODO: Update the state of card.
                    PlayingZone.Instance.UpdateTheStateCardsInZone();

                    // TODO: Update the score.
                    Contains.Score += Contains.ScoreResultCards;

                    // TODO: Update the display score.
                    UIBehaviours.Instance.UpdateScore();
                    //GamePlay.Instance.checkAutoWin();
                    if (GamePlay.Instance.IsConditionWining())
                    {
                        // TODO: Update the state of GameOver.
                        GameManager.Instance.UpdateState(Enums.StateGame.GameOver);

                        // TODO: Showing the wining dialog.
                        DialogSystem.Instance.ShowDialogWining();

                        var fireworks = PoolSystem.Instance.GetFromPool(Enums.PoolType.Fireworks);

                        if (!object.ReferenceEquals(fireworks, null))
                        {
                            fireworks.transform.SetParent(GamePlay.Instance.transform);

                            fireworks.transform.localPosition = Contains.Vector3Zero;

                            fireworks.gameObject.SetActive(true);
                        }

                        // TODO: Save the score.
                        PlayerData.BestScore = Contains.Score;

                        // TODO: Save the best move.
                        PlayerData.BestMove = Contains.Moves;

                        // TODO: Save the best time.
                        PlayerData.BestTime = Contains.Time;

                        // TODO: Play wining music.
                        SoundSystems.Instance.PlayerMusic(Enums.MusicIndex.WinMusic);
                    }
                });

                // TODO: Remove the card from list.
                PlayingZone.Instance.RemoveTheCard(card);

                // TODO: Add the card to the list result.
                ResultZone.Instance.AddTheCard(Enums.IdTransformCard.TransformCards_A, card);

                // TODO: Set the card save.
                GamePlay.Instance.cardSaveCache = card;

                return(true);
            }

            return(false);
        }
Beispiel #5
0
        /// <summary>
        /// Draws the cards.
        /// </summary>
        IEnumerator <float> _DrawCards(int numberCards)
        {
            // TODO: Get the list Cards from the zone.
            cardCache = HintZone.Instance.GetTheLastCard(Enums.IdTransformCard.TransformCards_A);

            // TODO: Check time ready to next card.
            bool IsReady = false;

            // TODO: Check the condition.
            if (!object.ReferenceEquals(cardCache, null))
            {
                // TODO: Record undo.
                UndoSystem.Instance.Record(Enums.Zone.Hint, Enums.IdTransformCard.TransformCards_A, cardCache, cardCache.IsUnlocked());

                // TODO: Add the arrays.
                var arrayCards = HintZone.Instance.GetTheListCards(Enums.IdTransformCard.TransformCards_B);

                // TODO: Sort the cards.
                Helper.SortCards(arrayCards, Enums.Direction.Right, HintZone.Instance.GetDefaultPosition(Enums.IdTransformCard.TransformCards_B));

                // TODO: Get the dafult transform from zone.
                Transform parentTransform = HintZone.Instance.GetTransformCards(Enums.IdTransformCard.TransformCards_B);

                // TODO: Get the position of card from zone.
                var position = Helper.GetPositionInTheHintZone(Enums.IdTransformCard.TransformCards_B, Enums.Direction.Right, true);

                // TODO: Set the target position x for the card.
                cardCache.TargetPosition.x = position.x;

                // TODO: Set the target position y for the card.
                cardCache.TargetPosition.y = position.y;

                // TODO: Set the target position z for the card.
                cardCache.TargetPosition.z = position.z;

                // TODO: Moving the card to new position.
                cardCache.Moving(cardCache.TargetPosition, parentTransform, () => {
                    // TODO: play the sounds.
                    SoundSystems.Instance.PlaySound(Enums.SoundIndex.Draw);

                    cardCache.Unlock(true, () => {
                        // TODO: Ready to draw another cards.
                        IsReady = true;
                    });
                });

                // TODO: Remove the cards from the list.
                HintZone.Instance.RemoveTheCard(cardCache);

                // TODO: Add the new card.
                HintZone.Instance.AddTheCard(Enums.IdTransformCard.TransformCards_B, cardCache);

                // TODO: Set the card unlocked.
                GamePlay.Instance.cardSaveCache = cardCache;
            }
            else
            {
                // TODO: Get the arrays.
                var arrayCards = new List <CardBehaviour> (HintZone.Instance.GetTheListCards(Enums.IdTransformCard.TransformCards_B));

                if (!object.ReferenceEquals(arrayCards, null))
                {
                    // TODO: Get the trasnform A.
                    var transformA = HintZone.Instance.GetTransformCards(Enums.IdTransformCard.TransformCards_A);

                    for (int i = arrayCards.Count - 1; i > -1; i--)
                    {
                        UndoSystem.Instance.Record(Enums.Zone.Hint, Enums.IdTransformCard.TransformCards_B, arrayCards [i], arrayCards [i].IsUnlocked(), i != arrayCards.Count - 1, false);

                        arrayCards [i].TargetPosition = HintZone.Instance.GetDefaultPosition(Enums.IdTransformCard.TransformCards_A);

                        // TODO: Lock the cards.
                        arrayCards [i].Lock();

                        // TODO: Get the
                        arrayCards [i].Moving(arrayCards [i].TargetPosition, HintZone.Instance.GetTransformCards(Enums.IdTransformCard.TransformCards_A), null, true);

                        // TODO: Remove the old cards.
                        HintZone.Instance.RemoveTheCard(Enums.IdTransformCard.TransformCards_B, arrayCards [i]);

                        // TODO: Set the default list card.
                        HintZone.Instance.AddTheCard(Enums.IdTransformCard.TransformCards_A, arrayCards [i]);
                    }

                    // TODO: Return waiting time.
                    yield return(Timing.WaitForSeconds(1f));

                    IsReady = true;
                }
                else
                {
                    IsReady = true;
                }
            }

            while (IsReady == false)
            {
                yield return(0f);
            }

            // TODO: Check the current state of game.
            if (GameManager.Instance.GetStateGame() == Enums.StateGame.Drawing)
            {
                // TODO: Update the current state.
                GameManager.Instance.UpdateState(Enums.StateGame.Playing);
            }
        }
Beispiel #6
0
        /// <summary>
        /// Draws the cards.
        /// </summary>
        IEnumerator <float> _DrawCards(int numberCards)
        {
            // TODO: Get the list Cards from the zone.
            cardCache = HintZone.Instance.GetTheLastCard(Enums.IdTransformCard.TransformCards_A);

            // TODO: Check time ready to next card.
            bool IsReady = false;

            // TODO: Check the condition.
            if (!object.ReferenceEquals(cardCache, null))
            {
                // TODO: Record undo.
                UndoSystem.Instance.Record(Enums.Zone.Hint, Enums.IdTransformCard.TransformCards_A, cardCache, cardCache.IsUnlocked());

                // TODO: Get the dafult transform from zone.
                Transform parentTransform = ResultZone.Instance.GetTransformCards(Enums.IdTransformCard.TransformCards_A);

                // TODO: Get the position of card from zone.
                var position = Helper.GetPositionInTheResultZone(Enums.IdTransformCard.TransformCards_A, Enums.Direction.None, true);

                // TODO: Set the target position x for the card.
                cardCache.TargetPosition.x = position.x;

                // TODO: Set the target position y for the card.
                cardCache.TargetPosition.y = position.y;

                // TODO: Set the target position z for the card.
                cardCache.TargetPosition.z = position.z;
                //Debug.Log("cardCache -- " + cardCache.TargetPosition);

                // TODO: Moving the card to new position.
                cardCache.Moving(cardCache.TargetPosition, parentTransform, () => {
                    // TODO: play the sounds.
                    SoundSystems.Instance.PlaySound(Enums.SoundIndex.Draw);

                    cardCache.Unlock(true, () => {
                        // TODO: Ready to draw another cards.
                        IsReady = true;
                    });
                });

                // TODO: Remove the cards from the list.
                HintZone.Instance.RemoveTheCard(cardCache);

                // TODO: Add the new card.
                ResultZone.Instance.AddTheCard(Enums.IdTransformCard.TransformCards_A, cardCache);

                // TODO: Set the card unlocked.
                GamePlay.Instance.cardSaveCache = cardCache;
            }
            else
            {
                IsReady = true;
            }

            while (IsReady == false)
            {
                yield return(0f);
            }

            // TODO: Check the current state of game.
            if (GameManager.Instance.GetStateGame() == Enums.StateGame.Drawing)
            {
                // TODO: Update the current state.
                GameManager.Instance.UpdateState(Enums.StateGame.Playing);
            }
        }
Beispiel #7
0
        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);
        }
Beispiel #8
0
    /// <summary>
    /// Distributes the follow cards.
    /// </summary>
    public void DistributeTheFollowCards()
    {
        // TODO: Get the list of cards follow.
        List <CardBehaviour> cardsFollow = HelperZone.Instance.GetListCards();

        // TODO: Get the count of list.
        int count = cardsFollow.Count;

        // TODO: Break the function if don't have any cards follow.
        if (count == 0)
        {
            return;
        }

        // TODO: Get the id of the list.
        Enums.IdTransformCard id = PlayingZone.Instance.GetIdTransform(this);

        // TODO: Get the parent transform.
        Transform parentFollow = PlayingZone.Instance.GetTransformCards(id);

        // TODO: Get the cache of card.
        CardBehaviour cardCache = null;

        // TODO: Loop to distribute the childs.
        for (int i = 0; i < cardsFollow.Count; i++)
        {
            // TODO: Set the cache.
            cardCache = cardsFollow [i];

            // TODO: Set the parent.
            cardCache.transform.SetParent(parentFollow);

            // TODO: Get the target position.
            cardCache.TargetPosition = Helper.GetPositionInThePlayingZone(id, Enums.Direction.Down, cardCache.IsUnlocked());


            // TODO: Set the index view.
            cardCache.transform.SetAsLastSibling();

            // TODO: Update the new card to the list.
            PlayingZone.Instance.AddTheCard(id, cardCache);

            // TODO: Unlocking the state.
            cardCache.UpdateReadyToUse(Enums.StateCard.None);
        }

        // TODO: Clear all the old cards in the list.
        HelperZone.Instance.Clear();
    }