static void AddToCache(GameObject key, Bubble bubble) { if (Cache == null) { Cache = new Dictionary <GameObject, Bubble>(); } if (Cache.ContainsKey(key)) { return; } Cache.Add(key, bubble); }
void TryRemoveConnectedBubble(Bubble bubble) { if (!bubble) { return; } if (!CheckConnectedBubble(bubble)) { return; } _connectedBubbles.Remove(bubble); }
bool CheckAllConnectedBubble(Bubble bubble) { if (CheckConnectedBubble(bubble)) { return(true); } foreach (var curBubble in _connectedBubbles) { if (curBubble.CheckConnectedBubble(bubble)) { return(true); } } return(false); }
void TryAddConnectedBubble(Bubble bubble) { if (!bubble) { return; } if ((bubble._bubbleTag != _bubbleTag) || (bubble == this)) { return; } if (CheckAllConnectedBubble(bubble)) { return; } _connectedBubbles.Add(bubble); }
bool CheckConnectedBubble(Bubble bubble) { return(_connectedBubbles.IndexOf(bubble) != -1); }