예제 #1
0
    private bool ClearMatch(Vector2[] directions)
    {
        List <GameObject> matchingCandies = new List <GameObject>();

        foreach (Vector2 direction in directions)
        {
            matchingCandies.AddRange(FindMatch(direction));
        }
        if (matchingCandies.Count >= BoardManager.MinCandiesToMatch)
        {
            for (int i = 0; i < 1; i++)
            {
                goalManager.CollectCandy(matchingCandies[i].GetComponent <SpriteRenderer>().sprite.ToString());
            }
            foreach (GameObject candy in matchingCandies)
            {
                goalManager.CompareGoals(candy.GetComponent <SpriteRenderer>().sprite.ToString());
                goalManager.UpdateGoals();

                candy.GetComponent <SpriteRenderer>().sprite = null;
            }
            return(true);
        }
        else
        {
            return(false);
        }
    }