/// <summary> /// Calls the powerup to take effect. /// </summary> /// <param name="powerup">Powerup to activate</param> private void ApplyPowerup(IPowerup powerup) { //configures powerup powerup.Apply(gameObject); //if it's a duration-type powerup if (typeof(IDurationPowerup).IsAssignableFrom(powerup.GetType())) { IDurationPowerup durationPowerup = (IDurationPowerup)powerup; //start the effect StartCoroutine(durationPowerup.AbilityEffect()); } }