override protected void OnReactionEvent(BubbleReactionEvent gameEvent)
 {
     if (gameEvent.priority == priority)
     {
         GetAdjacentBubbles(scheduledBubbles, gameEvent.bubble);
     }
 }
Ejemplo n.º 2
0
    public bool CheckForMatches()
    {
        var bubbleList = new List <Bubble>();

        bubbleList.Add(this);

        foreach (Bubble bubble in Neighbors)
        {
            if (!bubbleList.Contains(bubble) && IsMatching(bubble))
            {
                bubbleList.Add(bubble);
                GraphUtil.MatchNeighbors(bubbleList, bubble, bubble.IsMatching);
            }
        }

        var matchMade = bubbleList.Count >= definition.MatchThreshold;

        if (matchMade)
        {
            foreach (var bubble in bubbleList)
            {
                BubbleReactionEvent.Dispatch(ReactionPriority.Pop, bubble);
            }
        }

        return(matchMade);
    }
Ejemplo n.º 3
0
 private void DestroyOnReaction(Collider2D collider)
 {
     if ((collider.gameObject.tag == StringConstants.Tags.BUBBLES) && collider.gameObject.GetComponent <BubbleSnap>())
     {
         var model = gameObject.GetComponent <BubbleModelBehaviour>().Model;
         BubbleReactionEvent.Dispatch(ReactionPriority.PhysicsDestroy, model);
     }
 }
    private void PerformScanForNonClouds()
    {
        var model    = GetComponent <BubbleModelBehaviour>().Model;
        var attached = GraphUtil.SearchBreadthFirst(model, false, AttachedToNonCloud);

        if (!attached)
        {
            BubbleReactionEvent.Dispatch(ReactionPriority.ChainPop, model);
        }

        scanScheduled = false;
    }
Ejemplo n.º 5
0
        private void ConvertToRainbow(GameObject bubble)
        {
            var model = bubble.GetComponent <BubbleModelBehaviour>().Model;

            model.type       = BubbleType.Rainbow;
            model.definition = shooterDefinition;

            BubbleReactionEvent.Dispatch(ReactionPriority.CullRainbow, model);

            bubble.GetComponent <BubbleDeath>().DeactivateObjectOnDeath(instantiatedOverlay);
            instantiatedOverlay = null;
        }
Ejemplo n.º 6
0
        private void OnCollisionEnter2D(Collision2D collision)
        {
            var bubbleSnap = collision.collider.GetComponent <BubbleSnap>();

            if (bubbleSnap != null)
            {
                health -= 1;

                BubbleReactionEvent.Dispatch(Reaction.ReactionPriority.Cull, bubbleSnap.GetComponent <BubbleModelBehaviour>().Model);

                bubbleSnap.CompleteSnap();
                SetCurrentSkin();
            }
        }
        override protected IEnumerator Reaction()
        {
            var bubbles = scheduledBubbles;

            scheduledBubbles = new List <Bubble>();

            yield return(null);

            GraphUtil.RemoveNodes(bubbles);

            for (int index = 0, length = bubbles.Count; index < length; index++)
            {
                BubbleReactionEvent.Dispatch(ReactionPriority.GenericPop, bubbles[index]);
            }
        }
Ejemplo n.º 8
0
    override public void RemoveFromGraph()
    {
        base.RemoveFromGraph();

        BubbleReactionEvent.Dispatch(ReactionPriority.Cull, this);
    }
Ejemplo n.º 9
0
 private void PopAdjacent(Bubble bubble)
 {
     BubbleReactionEvent.Dispatch(ReactionPriority.ChainPop, bubble);
 }
Ejemplo n.º 10
0
 private void OnBubbleReaction(BubbleReactionEvent gameEvent)
 {
     AddBubble(gameEvent.priority, gameEvent.bubble);
 }