private void verifyBubbles() { if (toExplode.activeSelf) { for (int i = bubblesExplode.Length - 1; i > 0; i--) { BubbleController b = bubblesExplode [i]; if (b.isExplodeMe()) { b.explode(); if (currentSituation == 7) { quantBubblesExplode--; } } else if (b.isRemoveMe()) { b.transform.position = new Vector3(-100, -100, 0); } if (selectedBubble != null && b == selectedBubble) { continue; } b.moveMe(); } } if (toMix.activeSelf) { for (int i = bubblesMix.Length - 1; i > 0; i--) { BubbleController b = bubblesMix [i]; if (b.isExplodeMe()) { b.explode(); if (currentSituation == 14) { quantBubblesMix--; } } else if (b.isRemoveMe()) { b.transform.position = new Vector3(-100, -100, 0); } if (selectedBubble != null && b == selectedBubble) { continue; } b.moveMe(); } } }
public void hitMe(BubbleController bubble) { bool broken = false; if (bubble.isMovingTo() && bubble.get_bubble_b() == null) { foreach (Spark s in sparks_left) { if (GameSethings.getColorName(s.getColor()).Equals(bubble.getColor())) { s.toRemove(); broken = true; break; } } if (!broken) { foreach (Spark s in sparks_right) { if (GameSethings.getColorName(s.getColor()).Equals(bubble.getColor())) { s.toRemove(); broken = true; break; } } } } if (broken) { timeToAnimaHit = 0.1f; } bubble.explode(); }
void FixedUpdate() { if (bubbles.Count > 0) { int addCombo = 0; float posXcombo = -100; float posYcombo = -100; for (int i = bubbles.Count - 1; i > 0; i--) { BubbleController b = bubbles [i]; if (b.isExplodeMe()) { if (b.isSecondaryColor()) { gameManager.addScore(GameSethings.joinBubbles.EXPLODE_SECONDARY); if (addCombo != 3) { addCombo = 2; } } else if (b.isTertiaryColor()) { gameManager.addScore(GameSethings.joinBubbles.EXPLODE_TERTIARY); posXcombo = b.transform.position.x; posYcombo = b.transform.position.y; addCombo = 3; } else { gameManager.addScore(GameSethings.joinBubbles.EXPLODE_PRIMATY); } b.explode(); } else if (b.isRemoveMe()) { if (b.isSecondaryColor()) { gameManager.addScore(GameSethings.joinBubbles.MIX_SECONDARY); } else { gameManager.addScore(GameSethings.joinBubbles.MIX_PRIMATY); } bubbles.Remove(b); availableBubbles.Add(b); //Remover boolean de cor terceárea. if (b.getColor().Equals("RedPurple")) { tertiaryColors[0] = false; } else if (b.getColor().Equals("RedOrange")) { tertiaryColors[1] = false; } else if (b.getColor().Equals("BluePurple")) { tertiaryColors[2] = false; } else if (b.getColor().Equals("YellowOrange")) { tertiaryColors[3] = false; } else if (b.getColor().Equals("YellowGreen")) { tertiaryColors[4] = false; } else if (b.getColor().Equals("BlueGreen")) { tertiaryColors[5] = false; } b.transform.position = new Vector3(-100, -100, 0); b.gameObject.SetActive(false); gameManager.attQuantBubbles(bubbles.Count - 1); } if (selectedBubble != null && b == selectedBubble) { continue; } b.moveMe(); } if (addCombo == 2) { gameManager.addSecondaryCombo(); } else if (addCombo == 3) { gameManager.addTertiaryCombo(posXcombo, posYcombo); } } }