public void ActivateBonus() { if (bonus != null) { bonus.Activate(spawner.getLastPiece()); hudManager.eraseBonus(this); hudManager.eraseMalus(this); removeBonus(); removeMalus(); } }
public void updateKeyboard() { for (int i=0; i<3; i++) { if(Input.GetKeyDown(controls[i])) { if(items[i] != null) { activeBonus = items[i]; activeBonus.Activate(); items[i] = null; } return; } } }
public void BurstBonusBubble(GameObject obj) { if (obj.name.StartsWith("Free")) { BurstGoodBubble(obj, freeBubblesSprites); freeBonus.Activate(); } else if (obj.name.StartsWith("Fire") || obj.name.StartsWith("Poison") || obj.name.StartsWith("Ghost")) { visualBonus.Activate(); if (obj.name.StartsWith("Fire")) { visualBonus.Name = BonusType.Fire; BurstGoodBubble(obj, fireBubblesSprites); } else if (obj.name.StartsWith("Poison")) { visualBonus.Name = BonusType.Poison; BurstGoodBubble(obj, poisonBubblesSprites); } else { visualBonus.Name = BonusType.Ghost; BurstGoodBubble(obj, ghostBubblesSprites); } } else { float bonusValue = (float)Math.Round(UnityEngine.Random.Range(0.3f, 0.8f), 1); BonusType type; if (obj.name.StartsWith("Fast")) { BurstGoodBubble(obj, fastBubblesSprites); type = BonusType.Fast; bonusText.color = new Color(1, 0.7f, 0); bonusTimerImage.color = new Color(1, 0.7f, 0); } else if (obj.name.StartsWith("Slow")) { BurstGoodBubble(obj, slowBubblesSprites); type = BonusType.Slow; bonusText.color = Color.green; bonusTimerImage.color = Color.green; } else if (obj.name.StartsWith("Carma")) { BurstGoodBubble(obj, carmaBubblesSprites); type = BonusType.Carma; bonusText.color = Color.magenta; bonusTimerImage.color = Color.magenta; } else { BurstGoodBubble(obj, scoreBubblesSprites); type = BonusType.Score; bonusText.color = Color.yellow; bonusTimerImage.color = Color.yellow; } bonus = new Bonus(type, bonusValue, 10); } if (obj.GetComponentInChildren <CloseHelp>()) { obj.GetComponentInChildren <CloseHelp>().onHelpClose(); } }