private void CycleLocalQueue() { var lastIndex = nextBubbles.Length - 1; var first = nextBubbles[0]; var firstType = nextTypes[0]; for (var index = 0; index < lastIndex; index++) { nextBubbles[index] = nextBubbles[index + 1]; nextTypes[index] = nextTypes[index + 1]; } nextTypes[lastIndex] = firstType; nextBubbles[lastIndex] = first; for (var index = 0; index <= lastIndex; index++) { if (nextBubbles[index] != null) { MoveBubbleWithArc(index); } } SetShooterBubbleEvent.Dispatch(nextBubbles[0]); }
private void CreateBubbles() { var offset = new Vector3(0, -GlobalState.Instance.Config.bubbles.size / 2); for (var index = 0; index < nextBubbles.Length; index++) { if (nextBubbles[index] == null) { nextTypes[index] = level.levelState.bubbleQueue.Peek(index); nextBubbles[index] = level.bubbleFactory.CreateByType(nextTypes[index]); nextBubbles[index].transform.SetParent(locations[index], false); nextBubbles[index].transform.position = locations[index].position + offset; nextBubbles[index].layer = (int)Layers.Default; StartCoroutine(MoveBubbleRoutine(nextBubbles[index].transform, locations[index], 0.0f)); } } SetShooterBubbleEvent.Dispatch((nextBubbles.Length > 0) ? nextBubbles[0] : null); }