IEnumerator BubbleRecharge() { hasBubbleInvincibilty = false; bubbleController.EnableBubble(false); yield return(new WaitForSeconds(5.0f)); hasBubbleInvincibilty = true; bubbleController.EnableBubble(true); }
void updateCurrentSelection() { if (currentAbility == "magnet") { selectedImage.sprite = magnetSprite; selectedAbility.sprite = magnetSprite; ResetPlayerSpeed(70); } else if (currentAbility == "flower") { selectedImage.sprite = flowerSprite; selectedAbility.sprite = flowerSprite; ResetPlayerSpeed(70); } else if (currentAbility == "speed") { selectedImage.sprite = speedSprite; selectedAbility.sprite = speedSprite; } else if (currentAbility == "bubble") { selectedImage.sprite = bubbleSprite; selectedAbility.sprite = bubbleSprite; } else { selection.SetActive(false); ability.SetActive(false); return; } BubbleController bubbleController = GameObject.Find("obj_player").GetComponent <BubbleController>(); if (currentAbility == "bubble") { bubbleController.EnableBubble(true); } else { bubbleController.EnableBubble(false); } selection.SetActive(true); ability.SetActive(true); }