Its saying I have an error on line 24
fighter.Attack(player);
using System.Collections;
using System.Collections.Generic;
using RPG.Combat;
using UnityEngine;
namespace RPG.Control
{
public class AIController : MonoBehaviour
{
[SerializeField] float chaseDistance = 5f;
Fighter fighter;
GameObject player;
private void Start(){
fighter = GetComponent<Fighter>();
player = GameObject.FindWithTag("Player");
}
private void Update()
{
if (InAttackRangeOfPlayer() && fighter.CanAttack(player))
{
fighter.Attack(player);
}
}
private bool InAttackRangeOfPlayer()
{
float distanceToPlayer = Vector3.Distance(player.transform.position, transform.position);
return distanceToPlayer < chaseDistance;
}
}
}