Ejemplo n.º 1
0
        public void AddACard(SCR_MemoramaCard _card)
        {
            currentTurnedCards.Add(_card);
            if (currentTurnedCards.Count > 2)
            {
                SCR_MemoramaCard firstCard = currentTurnedCards[0];
                currentTurnedCards.Remove(currentTurnedCards[0]);
                firstCard.Turn();
            }

            if (currentTurnedCards.Count == 2)
            {
                if (currentTurnedCards[0].connection.frontSource == currentTurnedCards[1].frontSource)
                {
                    currentTurnedCards[0].Match(currentTurnedCards[1]);
                    Debug.Log("Same sprite");
                }
                //Check if shown cards arent a match (if they are a match, it's automatically check inside each MemoramaCard)
                else if (currentTurnedCards[0].connection != currentTurnedCards[1])
                {
                    minigame.RestLife();
                    //Voltear las dos
                    currentTurnedCards[0].Turn();
                    currentTurnedCards[1].Turn();
                    currentTurnedCards.Clear();
                }

#if UNITY_EDITOR
                else
                {
                    Debug.Log("1. Connections do match!");
                }
#endif
            }
        }
Ejemplo n.º 2
0
 public void Match(SCR_MemoramaCard con)
 {
     wasAMatch = true;
     memoramaManager.RemoveACard(this);
     memoramaManager.RemoveACard(con);
     connection = con;
     MarkAsCompleted();
 }
Ejemplo n.º 3
0
        IEnumerator ImportSprite(string url, SCR_MemoramaCard _card)
        {
            Texture2D tex = new Texture2D(4, 4, TextureFormat.DXT1, false);
            WWW       www = new WWW("file://" + url);

            yield return(www);

            //Debug.Log("Finished" + url);
            //Debug.Log("Bytes downloaded" + www.bytesDownloaded);
            www.LoadImageIntoTexture(tex);
            _card.front = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
        }
Ejemplo n.º 4
0
 public void RemoveACard(SCR_MemoramaCard _card)
 {
     currentTurnedCards.Remove(_card);
 }
Ejemplo n.º 5
0
 public bool IsCardTurned(SCR_MemoramaCard _card)
 {
     return(currentTurnedCards.Find(x => _card));
 }