// public void Attack(GameObject combatTarget) // { // attackTime = Util.GetCurrentAnimationTime(attackTime,"attack",anim); // target = combatTarget.GetComponent<Health>(); // mover.Cancel(); // GetComponent<ActionScheduler>().StartAction(this); // } public void Attack(GameObject combatTarget) { float staminaToConsume = currentWeaponConfig.GetStaminaPerHit(); attackTime = Util.GetCurrentAnimationTime(attackTime, "attack", anim) / 2; if (combatTarget != null) { //for AiController mover.Cancel(); target = combatTarget.GetComponent <Health>(); GetComponent <ActionScheduler>().StartAction(this); } else { //for PlayerController AttackBehaviour(staminaToConsume); } }