// Update is called once per frame void Update() { if (hitOnce == false) { if (!spellMoves) { if (serverSpell) { hitOnce = true; _parentCastSpell.applyAbilityEffect(_parentCastSpell.abilityNum); //gameObject.transform.parent = null; } } } if (source.clip.length - source.time <= 1) { source.volume = maxVolume * (source.clip.length - source.time); } //if the spell animation is no longer playing destroy it if (this.GetComponent <ParticleSystem>().isPlaying == false) { GameObject.Destroy(gameObject); } if (source.clip.length - source.time > 1) { if (source.time <= 1) { source.volume = maxVolume * source.time; } else { source.volume = maxVolume; } } }