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 } }
public void Match(SCR_MemoramaCard con) { wasAMatch = true; memoramaManager.RemoveACard(this); memoramaManager.RemoveACard(con); connection = con; MarkAsCompleted(); }
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)); }
public void RemoveACard(SCR_MemoramaCard _card) { currentTurnedCards.Remove(_card); }
public bool IsCardTurned(SCR_MemoramaCard _card) { return(currentTurnedCards.Find(x => _card)); }