void Start() { state = JamesAIStates.WANDERING; agent = GetComponent <NavMeshAgent> (); GameObject obj = GameObject.FindGameObjectWithTag("AlanHealth"); Alan healthBar = obj.transform.GetComponent <Alan>(); health = healthBar.health; }
public void MakeDecision() { prevState = state; switch (state) { case JamesAIStates.IDLE: state = Idle(); break; case JamesAIStates.WANDERING: state = Wander(); break; case JamesAIStates.CHASING: state = Chase(); break; case JamesAIStates.ATTACK: state = Attack(); break; } }