public void AddACard(SCR_Card _card)
    {
        currentTurnedCards.Add(_card);
        if (currentTurnedCards.Count > 2)
        {
            SCR_Card firstCard = currentTurnedCards[0];
            currentTurnedCards.Remove(currentTurnedCards[0]);
            firstCard.Turn();
        }

        if (currentTurnedCards.Count == 2)
        {
            //Check if shown cards arent a match
            if (currentTurnedCards[0].front != currentTurnedCards[1].front)
            {
                RestLife();
                //Voltear las dos
                currentTurnedCards[0].Turn();
                currentTurnedCards[1].Turn();
                currentTurnedCards.Clear();
            }
            else
            {
                currentTurnedCards[0].FoundMatch(currentTurnedCards[1]);
            }
        }
    }
Ejemplo n.º 2
0
 public void Match(SCR_Card con)
 {
     wasAMatch = true;
     memoramaManager.RemoveACard(this);
     memoramaManager.RemoveACard(con);
     connection = con;
     MarkAsCompleted();
 }
Ejemplo n.º 3
0
//        IEnumerator WaitForCheck()
//        {
//            yield return new WaitForEndOfFrame(); //Check if its connection is showing too
//            if (connection != null && connection.connection != null)
//            {
//                if (connection.IsShowing() && memoramaManager.IsCardTurned(this) && memoramaManager.IsCardTurned(connection) && connection.gameObject.activeSelf)
//                {
//#if UNITY_EDITOR
//                    Debug.Log("2. They were indeed a match.");
//#endif
//                    wasAMatch = true;
//                    memoramaManager.RemoveACard(this);
//                    memoramaManager.RemoveACard(connection);
//                    MarkAsCompleted();
//                }
//            }
//        }

    public void FoundMatch(SCR_Card _conn)
    {
        wasAMatch  = true;
        connection = _conn;
        memoramaManager.RemoveACard(this);
        memoramaManager.RemoveACard(connection);
        MarkAsCompleted();
    }
 public void RemoveACard(SCR_Card _card)
 {
     currentTurnedCards.Remove(_card);
 }
 public bool IsCardTurned(SCR_Card _card)
 {
     return(currentTurnedCards.Find(x => _card));
 }
Ejemplo n.º 6
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     myCard = animator.GetComponent <SCR_Card>();
 }