예제 #1
0
    protected void TryMatch()
    {
        if (firstSelected.CheckMatch(secondSelected))
        {
            IncrementScore(1);
            UpdateSpawnTime();

            tilesOnScreen.Remove(firstSelected);
            tilesOnScreen.Remove(secondSelected);

            MatchSFX.Play();
            firstSelected.GenerateMatchParticles();
            secondSelected.GenerateMatchParticles();
            Destroy(firstSelected.gameObject);
            Destroy(secondSelected.gameObject);
        }
        else
        {
            Debug.Log("no");
            firstSelected.UnSelect();
            secondSelected.UnSelect();
        }
        firstSelected  = null;
        secondSelected = null;
    }
예제 #2
0
    protected void TryMatch()
    {
        if (firstSelected.CheckMatch(secondSelected))
        {
            IncrementScore(1);

            tilesOnScreen.Remove(firstSelected);
            tilesOnScreen.Remove(secondSelected);

            firstSelected.markedToDestroy  = true;
            secondSelected.markedToDestroy = true;

            MatchSFX.Play();
            firstSelected.GenerateMatchParticles();
            secondSelected.GenerateMatchParticles();
            Destroy(firstSelected.gameObject);
            Destroy(secondSelected.gameObject);

            CreateCard();
            CreateCard();
        }
        else
        {
            if (firstSelected.drugName != secondSelected.drugName)
            {
                livesLeft    -= 1;
                secondaryText = "Lives: " + livesLeft;
                if (livesLeft == 0)
                {
                    Invoke("GameOver", 1);
                }
            }
            firstSelected.UnSelect();
            secondSelected.UnSelect();
        }
        firstSelected  = null;
        secondSelected = null;
    }