override protected void OnReactionEvent(BubbleReactionEvent gameEvent) { if (gameEvent.priority == priority) { GetAdjacentBubbles(scheduledBubbles, gameEvent.bubble); } }
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); }
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; }
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; }
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]); } }
override public void RemoveFromGraph() { base.RemoveFromGraph(); BubbleReactionEvent.Dispatch(ReactionPriority.Cull, this); }
private void PopAdjacent(Bubble bubble) { BubbleReactionEvent.Dispatch(ReactionPriority.ChainPop, bubble); }
private void OnBubbleReaction(BubbleReactionEvent gameEvent) { AddBubble(gameEvent.priority, gameEvent.bubble); }