Hello everyone. If this is active the following message appears Assets\Script\Control\AIController.cs(27,39): error CS1061:
What could I have done wrong?
using System.Collections;
using System.Collections.Generic;
using RPG.Combat;
using RPG.Core;
using RPG.Movement;
using UnityEngine;
namespace RPG.Control
{
public class AIController : MonoBehaviour
{
[SerializeField] float chaseDistance = 5f;
Fighter fighter;
Health health;
Mover mover;
GameObject player;
Vector3 guardPosition;
private void Start() {
fighter = GetComponent<Fighter>();
health = GetComponent<Health>();
mover = GetComponent<Mover>();
player = GameObject.FindWithTag("Player");
guardPosition = transform.positon;// <---fail
}
private void Update()
{
if (health.IsDead()) return;
if (InAttacktRangeOfPlayer() && fighter.CanAttack(player))
{
fighter.Attack(player);
}
else
{
//fighter.Cancel();
mover.StartMoveAction(guardPosition);
}
}
private bool InAttacktRangeOfPlayer()
{
float distanceToPlayer = Vector3.Distance(player.transform.position, transf
return distanceToPlayer < chaseDistance;
}
// called by Unity
private void OnDrawGizmosSelected() {
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position, chaseDistance);
}
}
}
thanks in advance for the help.