void shoot() { // Reset the timer. timer = 0f; if (ability) { audioManager.spellCastAudio(); anim.SetTrigger("Cast"); GameObject abilityInstance = Instantiate(ability, transform.position, transform.rotation) as GameObject; AbilityStats instanceStats = abilityInstance.GetComponent <AbilityStats>(); AbilityStats stats = gameObject.GetComponent <AbilityStats>(); instanceStats.newItem = stats.newItem; instanceStats.abilityName = stats.abilityName; instanceStats.damageLowerBound = stats.damageLowerBound; instanceStats.damageUpperBound = stats.damageUpperBound; instanceStats.manaCost = stats.manaCost; instanceStats.coolDown = stats.coolDown; instanceStats.specialEffectName = stats.specialEffectName; instanceStats.specialEffectDamage = stats.specialEffectDamage; instanceStats.specialEffectDuration = stats.specialEffectDuration; instanceStats.specialEffectRepeat = stats.specialEffectRepeat; instanceStats.abilityIcon = stats.abilityIcon; instanceStats.abilityItem = stats.abilityItem; playerHealth.reduceMana(manaCost); if (playerCtrl.facingLeft) { Vector3 scale = abilityInstance.transform.localScale; scale.x *= -1; abilityInstance.transform.localScale = scale; } } }