Sprite GetSpriteForPower(GameButton.SuperPower power) { switch (power) { case GameButton.SuperPower.AllColor: return(RainbowSprite); case GameButton.SuperPower.AllExplode: return(CarrotSprite); case GameButton.SuperPower.IgnoreColor: return(ShadesSprite); case GameButton.SuperPower.None: return(null); case GameButton.SuperPower.ScoreMultiplier: return(ScoreSprite); case GameButton.SuperPower.Shuffle: return(ShuffleSprite); case GameButton.SuperPower.StopTimer: return(ClockSprite); default: return(null); } }
public void GrantPower(GameButton.SuperPower power) { var buttons = GameObject.FindObjectsOfType <GameButton>(); foreach (var button in buttons) { if (button.Power == power) { button.ButtonEnabled = true; } } }