private void SetTarget() { if (spell != null) { ValidLocation = spell.GetComponent <SpellBase>().GetLocation(); spellDirection = spell.GetComponent <SpellBase>().GetDirection(); Vector3 pos = Vector3.zero; if (spellTarget != null) { pos = spellTarget.transform.position; Destroy(spellTarget.gameObject); } if (spellDirection == SpellDirection.Right || spellDirection == SpellDirection.Left) { spellTarget = Instantiate(targeting[1], pos, Quaternion.identity); } else if (spellDirection == SpellDirection.Ceiling || spellDirection == SpellDirection.Floor) { spellTarget = Instantiate(targeting[0], pos, Quaternion.identity); } else { spellTarget = Instantiate(targeting[2], pos, Quaternion.identity); //spellTarget = spell.InstantiateSpell(Vector3.zero); } Destroy(spellTarget.GetComponent <Collider>()); } }
public void DestroyTarget() { if (spellTarget != null) { Destroy(spellTarget); ValidLocation = 0; spellDirection = 0; spellSpeed = 0; spellTarget = null; } }