Beispiel #1
0
        /*
         * Backtrackng recursive function that obtains the cluster of bubble
         * which share the same color for a given location
         */
        private ArrayList colorClusterRecursive(Bubble bubble, ArrayList visited)
        {
            ArrayList similarColorNeighbours = JQUtils.FilterByColor(this.neighbours(bubble), bubble.color);

            similarColorNeighbours.Exclusive(visited);
            visited.Add(bubble);
            ArrayList returnArray = new ArrayList();

            returnArray.Add(bubble);
            foreach (Bubble aBubble in similarColorNeighbours)
            {
                if (bubble != aBubble)
                {
                    returnArray.AddRange(colorClusterRecursive(aBubble, visited));
                }
            }
            return(returnArray);
        }
 void Start()
 {
     this.renderer.material.color = JQUtils.ColorForBubbleColor(bubble.color);
 }
 void Awake()
 {
     bubble = new Bubble(JQUtils.GetRandomEnum <BubbleColor>());
 }
 void Start()
 {
     this.GetComponent <SpriteRenderer>().material.color = JQUtils.ColorForBubbleColor(bubble.color);
 }