private IEnumerator RemoveEnchant(float duration) { yield return(new WaitForSeconds(duration)); _dispenser = null; enchantmentParticles.Stop(); }
/// <summary> /// Enchants the weapon with the specified effect-dispenser, particle-color and duration. /// </summary> /// <param name="dispenser">EffectDispenser to instantiate effects.</param> /// <param name="particleColor">Particle color of the enchantment.</param> /// <param name="duration">Duration of the enchantment (0 yields until replaced).</param> public void Enchant(IEffectDispenser dispenser, Color particleColor, float duration) { _dispenser = dispenser; enchantmentParticles.startColor = particleColor; enchantmentParticles.Play(); if(duration > 0) StartCoroutine (RemoveEnchant (duration)); }
/// <summary> /// Enchants the weapon with the specified effect-dispenser, particle-color and duration. /// </summary> /// <param name="dispenser">EffectDispenser to instantiate effects.</param> /// <param name="particleColor">Particle color of the enchantment.</param> /// <param name="duration">Duration of the enchantment (0 yields until replaced).</param> public void Enchant(IEffectDispenser dispenser, Color particleColor, float duration) { _dispenser = dispenser; enchantmentParticles.startColor = particleColor; enchantmentParticles.Play(); if (duration > 0) { StartCoroutine(RemoveEnchant(duration)); } }
private IEnumerator RemoveEnchant(float duration) { yield return new WaitForSeconds (duration); _dispenser = null; enchantmentParticles.Stop (); }