示例#1
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);
				}
			}
		}
示例#2
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);
            }
        }
示例#3
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);
            }
        }