示例#1
0
    void Start()
    {
        startHeight = transform.position.y;

        //navMesh = GameObject.Find("NavMesh");
        //floor = GameObject.Find("Floor");
        floorScript = floor.GetComponent <QuadTest>();
        agent       = GetComponent <NavMeshAgent>();
        player      = GameObject.FindWithTag("Player");
        agentState  = States.PATROLLING;
        //var tmpMin = floor.transform.position;
        //var tmpMax = floor.transform.position - new Vector3(floorScript.segments * floorScript.mesh_Width, 0, floorScript.segments * floorScript.mesh_Length);

        //transform.position = new Vector3(Random.Range(tmpMin.x, tmpMax.x), 4, Random.Range(tmpMin.z, tmpMax.z) );
        GoToNextPoint();
        //agent.SetDestination(new Vector3(1,0,0));
    }
示例#2
0
    void Start()
    {
        startHeight = transform.position.y;

        //navMesh = GameObject.Find("NavMesh");
        //floor = GameObject.Find("Floor");
        floorScript = floor.GetComponent<QuadTest>();
        agent = GetComponent<NavMeshAgent>();
        player = GameObject.FindWithTag("Player");
        agentState = States.PATROLLING;
        //var tmpMin = floor.transform.position;
        //var tmpMax = floor.transform.position - new Vector3(floorScript.segments * floorScript.mesh_Width, 0, floorScript.segments * floorScript.mesh_Length);

        //transform.position = new Vector3(Random.Range(tmpMin.x, tmpMax.x), 4, Random.Range(tmpMin.z, tmpMax.z) );
        GoToNextPoint();
        //agent.SetDestination(new Vector3(1,0,0));
    }