// Start is called before the first frame update void Start() { agent = this.GetComponent <NavMeshAgent>(); animator = this.GetComponent <Animator>(); currentState = new Idle(this.gameObject, agent, animator, enemy); healthBarAI = GetComponentInChildren <HealthBarAI>(); }
//closest edge mistake // Start is called before the first frame update void Start() { agent = GetComponent <NavMeshAgent>(); agent.stoppingDistance = 0; agent.autoBraking = true; c = gameObject.AddComponent <SphereCollider>(); c.isTrigger = true; c.radius = awarenessArea; //Initialize the AI state currentState = AIState.Idle; actionTimer = Random.Range(0.1f, 2.0f); SwitchAnimationState(currentState); healthBarAI = GetComponentInChildren <HealthBarAI>(); }
private void Awake() { healthBarAI = GetComponent <HealthBarAI>(); }