IEnumerator CastAtTime(float time) { while (true) { yield return(new WaitForSeconds(time)); spellCaster.CastAbility(ability); } }
void Update() { if (Input.GetKeyDown("space")) { spellCaster.CastAbility(hommingAbility); } Vector3 velocity = new Vector3 { x = joystick.JoystickAxis.x, y = 0, z = joystick.JoystickAxis.y }; spellCaster.velocity = velocity; if (velocity.magnitude > 0) { spellCaster.CastAbility(aimedAbility); } }