Exemple #1
0
    /// <summary>
    /// Check if there are some card that can be moved from deck to a positionGoal
    /// </summary>
    private bool CheckFromDeckToPositionGoal()
    {
        Deck scriptDeck = DeckObject.GetComponent <Deck>();
        Card scriptCard = scriptDeck.GetActiveCardFromWaste();

        if (scriptCard != null)
        {
            PositionGoalCard positionGoal = GetExactPositionGoal(scriptCard.Seed);
            Card             lastCard     = positionGoal.GetLastCard();
            if ((lastCard != null && scriptCard.Value == lastCard.Value + 1) || (lastCard == null && scriptCard.Value == 1))
            {
                helpCardMove      = scriptCard;
                helpFinalPosition = positionGoal.transform.position;
                return(true);
            }
        }
        return(false);
    }
Exemple #2
0
 /// <summary>
 /// Check if there are some card that can be moved from column to positionGoal
 /// </summary>
 private bool CheckFromColumnToPositionGoal()
 {
     foreach (GameObject col in columns)
     {
         Column scriptCol   = col.GetComponent <Column>();
         Card   lastCardCol = scriptCol.GetLastCard();
         if (lastCardCol != null)
         {
             PositionGoalCard positionGoal = GetExactPositionGoal(lastCardCol.Seed);
             Card             lastCardPos  = positionGoal.GetLastCard();
             if ((lastCardPos != null && lastCardCol.Value == lastCardPos.Value + 1) || (lastCardPos == null && lastCardCol.Value == 1))
             {
                 helpCardMove      = lastCardCol;
                 helpFinalPosition = positionGoal.transform.position;
                 return(true);
             }
         }
     }
     return(false);
 }