Example #1
0
        private void HandlePoppedBubbles(IEnumerable <Bubble> bubbles)
        {
            var bubbleList = bubbles.ToList();
            int totalScore = 0;

            while (bubbleList.Count > 0)
            {
                var cluster      = ExtractCluster(bubbleList);
                var multiplier   = ScoreUtil.ComputeClusterMultiplier(cluster.Count);
                var clusterScore = (int)(cluster[0].definition.Score * cluster.Count * multiplier);

                if (cluster[0].definition.category != BubbleCategory.Basic)
                {
                    multiplier = 1.0f;
                }

                ScoreMultiplierCallout callout = null;
                if ((multiplier >= 2.0f) && (multiplierCallout != null))
                {
                    callout = Instantiate(multiplierCallout).GetComponent <ScoreMultiplierCallout>();
                    callout.Initialize((int)Mathf.Floor(multiplier), clusterScore);
                    pendingCallout = callout;
                }

                foreach (var bubble in cluster)
                {
                    ShowBubbleScore(bubble, bubble.definition.Score);
                }

                totalScore += clusterScore;
            }

            AddToScore(totalScore);
        }
Example #2
0
 private void OnMultiplierCallout()
 {
     if (pendingCallout != null)
     {
         pendingCallout.Show();
         pendingCallout = null;
     }
 }