示例#1
0
 // Use this for initialization
 void Start()
 {
     _configuration = Configuration.Instance;
     _pill          = new Pill(Time.frameCount, _board.transform, transform, _grid);
     UpdatePoints   = UpdatePointsOnBoard;
     initColors     = new Color[2];
     initColors[0]  = _pill.PillParts["first"].PillPartColor;
     initColors[1]  = _pill.PillParts["second"].PillPartColor;
 }
示例#2
0
    public IEnumerator CheckMatches(Dictionary <string, Dictionary <string, int> > positions, Constants.UpdatePointsDelegate UpdatePoints)
    {
        List <string> keys = new List <string>(positions.Keys);

        for (int index = 0; index < keys.Count; index++)
        {
            if (positions[keys[index]] != null)
            {
                int          virusQuantity     = 0;
                List <int[]> matchesHorizontal = GetMatchesHorizontal(positions[keys[index]]["row"], positions[keys[index]]["column"]);
                List <int[]> matchesVertical   = GetMatchesVertical(positions[keys[index]]["row"], positions[keys[index]]["column"]);
                if (matchesHorizontal != null)
                {
                    virusQuantity += UpdateSpriteOfMatchesAndGetVirusQuantity(matchesHorizontal);
                    yield return(new WaitForSeconds(Constants.WaitBeforePotentialMatchesCheck));

                    RemoveMatchPills(matchesHorizontal);
                }

                if (matchesVertical != null)
                {
                    virusQuantity += UpdateSpriteOfMatchesAndGetVirusQuantity(matchesVertical);
                    yield return(new WaitForSeconds(Constants.WaitBeforePotentialMatchesCheck));

                    RemoveMatchPills(matchesVertical);
                }

                if (virusQuantity > 0)
                {
                    UpdatePoints(virusQuantity);
                }
            }
        }
    }