// On click event public void Onclick() { if (Spell.CurrentCooldown >= Spell.Cooldown) { _spellController.CastSpell(Spell); } }
private void ActivateSpellController(Vector3 spawnPoint, Vector3 velocity) { if (instantiatedSpellPrefab == null) { return; } instantiatedSpell.StopSoundEffect(SpellSoundEffect.Charging); instantiatedSpell.PlaySoundEffect(SpellSoundEffect.Fire, transform.position); instantiatedSpell.StopCharging(); SpellController spellController = instantiatedSpellPrefab.GetComponent <SpellController>(); spellController.CastSpell(gameObject, velocity); instantiatedSpellPrefab.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None; instantiatedSpellPrefab.transform.parent = null; instantiatedSpellPrefab.transform.position = spawnPoint; instantiatedSpellPrefab.transform.rotation = Quaternion.LookRotation(velocity); }