Beispiel #1
0
 // 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>();
 }
Beispiel #2
0
//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>();
    }
Beispiel #3
0
 private void Awake()
 {
     healthBarAI = GetComponent <HealthBarAI>();
 }