For some reason i get this error:
using UnityEngine;
using System.Collections;
public class EnemyPatrol : MonoBehaviour {
public Transform[] patrolPoints;
public float moveSpeed;
private int currentPointPosition;
public Transform Player;
private float chaseMoveSpeed = 2;
public float maxDist
public float minDist;
Renderer myRenderer;
float _nextMoveTime;
bool _isMoving = true;
void Start ()
{
myRenderer = GetComponent<Renderer>();
}
void FixedUpdate()
{
if (Vector3.Distance(transform.position, Player.position) <= minDist)
{
myRenderer.material.color = Color.blue;
transform.LookAt(Player);
transform.position += transform.forward * chaseMoveSpeed * Time.deltaTime;
}
[B]
if (Vector3.Distance(transform.position, Player.position) <= maxDist && >= minDist)
{
myRenderer.material.color = Color.yellow;
}[/B]
if (this._isMoving)
{
if (transform.position == patrolPoints[currentPointPosition].position) //you should consider replacing this with Vector3.Distance() < 0.01f or such to avoid issues from floating precision
{
currentPointPosition++;
if (currentPointPosition >= patrolPoints.Length)
{
currentPointPosition = 0;
}
//Initiate a delay before moving again
this._isMoving = false;
this._nextMoveTime = Time.time + 3;
}
else
{
transform.position = Vector3.MoveTowards(transform.position, patrolPoints[currentPointPosition].position, moveSpeed * Time.deltaTime);
}
}
//When not moving, check if delay is over
else if (this._nextMoveTime < Time.time)
{
this._isMoving = true;
}
}
}