private void Update() { dt += Time.deltaTime; if (dt > animSpeed) { dt = 0.0f; if (isSwinging) { frame++; if (frame >= frames.Length) { frame = 0; } if (frame == middleFrame) { melee.MeleeAttack(); reachedMiddle = true; } } else { frame = 0; } renderer.sprite = frames[frame]; } }
void Update() { AbilitySelection(); meleeRef.MeleeAttack(); Ability1Handling(); Ability2Handling(); Ability3Handling(); Ability4Handling(); }
private void Attack(GameObject target) { if (CanAttack == true) { AttackSound.Play(); _meleeWeapon.MeleeAttack(); CanAttack = false; if (target.gameObject.activeSelf == false) { GameObject newTarget = FindObjectOfType <Objective>().gameObject; EnemyTarget = newTarget; FaceObjective = newTarget; gameObject.GetComponent <NavMeshAgent>().SetDestination(EnemyTarget.transform.position); GetComponent <NavMeshAgent>().isStopped = false; } } }