void FixedUpdate() { //Debug.Log(currentState); //Debug.Log(agent.destination); //Debug.Log(damageableObject); //Debug.Log(agent.remainingDistance); currentState.UpdateStates(); if (currentState == attackState) { if (chaseTarget == null) { currentState = targetWayPoint; } else if (chaseTarget != null) { float dist = Vector3.Distance(chaseTarget.position, transform.position); if (dist >= 1500) { chaseTarget = null; } } } //else if (currentState != attackState) //{ //} }
void Start() { currentState = targetWayPoint; }