Ejemplo n.º 1
0
    private void Awake()
    {
        prevFramePos = this.transform.position;
        chaseState   = new ChaseState(this);
        alertState   = new AlertState(this);
        patrolState  = new PatrolState(this);
        attackState  = new AttackState(this);
        retreatState = new RetreatState(this);

        attackState.Start(); // note to self call start on states that it is needed

        navMeshAgent               = GetComponent <NavMeshAgent>();
        weaponSwingRenderer        = GetComponent <LineRenderer>();
        m_sphereCol                = GetComponent <SphereCollider>();
        m_animator                 = GetComponent <Animator>();
        m_animator.applyRootMotion = true;
    }