public bool UseSpell(SpellCaster sc) { if (actor.unit && !actor.unit.isAlive) { // error = "can't attack when you're dead... noob"; return(false); } RaycastHit hit = PlayerEntityController.GetClickedRaycast(); sc.actorTarget = hit.transform.GetComponent <Actor>(); sc.pointTarget = hit.point; string error; return(sc.TryCast(out error)); }
public bool OrderUseSpell(int spellIndex, Vector3 targetPoint, Actor targetActor, out string error) { if (moveRetained) { error = "you can't attack right now"; return(false); } if (unit && !unit.isAlive) { error = "can't attack when you're dead... noob"; return(false); } if (spellIndex >= spells.Count) { error = "spell doesn't exist"; return(false); } SpellCaster sc = spells[spellIndex]; sc.actorTarget = targetActor; sc.pointTarget = targetPoint; return(sc.TryCast(out error)); }