public override void Interact() { base.Interact(); CharCombat playerCombat = playerManager.player.GetComponent <CharCombat>(); if (playerCombat != null) { playerCombat.Attack(myStats); Debug.Log("you are attacking the enemy"); } }
void Update() { float distance = Vector3.Distance(target.position, transform.position); if (distance <= lookRadius) { agent.SetDestination(target.position); } if (distance <= agent.stoppingDistance) { CharStats targetStats = target.GetComponent <CharStats>(); if (targetStats != null) { combat.Attack(targetStats); } FaceTarget(); } }