Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        fov            = GetComponent <FieldOfView>();
        stateMachine   = GetComponent <AIStateMachine>();
        anim           = GetComponent <Animator>();
        myNavMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>();
        character      = GetComponent <ThirdPersonCharacterNoCrouch>();
        if (!isStationary)
        {
            setNextWaypoint();
        }
        else
        {
            //get rotation bounds for stationary guard
            Debug.Log(transform.forward);
            Debug.Log(Quaternion.Euler(0, rotation, 0) * transform.forward);
            Debug.Log(Quaternion.Euler(0, -rotation, 0) * transform.forward);
            startForward = transform.forward;
            leftBound    = Quaternion.Euler(0, -rotation, 0) * transform.forward;
            rightBound   = Quaternion.Euler(0, rotation, 0) * transform.forward;
            direction    = 1f;
            origin       = transform.position;
        }

        previousYRotate = this.transform.eulerAngles.y;
    }
Exemplo n.º 2
0
 // Start is called before the first frame update
 void Start()
 {
     fov            = GetComponent <FieldOfView>();
     stateMachine   = GetComponent <AIStateMachine>();
     anim           = GetComponent <Animator>();
     myNavMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent>();
     character      = GetComponent <ThirdPersonCharacterNoCrouch>();
     setNextWaypoint();
     previousYRotate = this.transform.eulerAngles.y;
 }