private bool InteractWithCombat() { if (Input.GetKeyDown(KeyCode.Q)) { _fighterSpell.Cast(CastSource.Weapon); } else if (Input.GetKeyDown(KeyCode.W)) { _fighterSpell.Cast(CastSource.Armor); } else if (Input.GetKeyDown(KeyCode.E)) { _fighterSpell.Cast(CastSource.Pet); } var hits = Physics.RaycastAll(GetMouseRay()); foreach (var hit in hits) { var target = hit.transform.GetComponent <CombatTarget>(); if (target == null || !Fighter.CanAttack(target.gameObject)) { continue; } if (Input.GetMouseButtonDown(0)) { _fighter.Attack(target.gameObject); } return(true); } return(false); }
private void CastSpell(CastSource castSource, Spell spell) { if (spell.IsSpellOnCooldown()) { return; } StartCoroutine(UpdateTimeBetweenSpell()); _aiController.UpdateRestTimer(restTimer); _fighterSpell.Cast(castSource); }