void Start() { GameObject emitterInstance = GameObject.Instantiate(emitter, transform.position, transform.rotation); emitterInstance.transform.SetParent(transform); castScript = emitterInstance.GetComponentInChildren <CastBehavior>(); emitterMuzzle = emitterInstance.transform.Find("EmitterMuzzle").transform; target = GameObject.FindGameObjectWithTag("Player").transform; }
public void Equip(int slot) { if (equippedSlot != slot) { Unequip(equippedSpell); equippedSlot = slot; int equipSlotZeroed = equippedSlot - 1; if (equippableSpells[equipSlotZeroed] != null) { equippedSpell = equippableSpells[equipSlotZeroed]; equippedSpell.SetActive(true); castScript = equippedSpell.GetComponent <CastBehavior>(); } } }