Пример #1
0
    // Use this for initialization
    void Start()
    {
        terrain = GameObject.FindGameObjectWithTag("Maze");
        script = terrain.GetComponent<mapScript1>();

        width = script.mask.GetUpperBound(0) + 1;
        height = script.mask.GetUpperBound(1) + 1;
        map = new int[width, height];

        for (int col = 0; col < width; col++)
        {
            for (int lin = 0; lin < height; lin++)
            {
                map[col, lin] = unknown;
            }
        }
    }
Пример #2
0
    void Start()
    {
        terrain = GameObject.FindGameObjectWithTag("Maze");
        mapScript = terrain.GetComponent<mapScript1>();
        offset = mapScript.offset;

        nexus = GameObject.FindGameObjectWithTag("Nexus");
        nexus_pos = nexus.GetComponent<Transform>().position;

        rb = GetComponent<Rigidbody>();
        nma = GetComponent<NavMeshAgent>();
        width = mapScript.mask.GetUpperBound(0) + 1;
        height = mapScript.mask.GetUpperBound(1) + 1;
        map = new int[width, height];

        for (int col = 0; col < width; col++)
        {
            for (int lin = 0; lin < height; lin++)
            {
                map[col, lin] = unknown;
            }
        }

        anim = this.gameObject.GetComponent<Animator>();
        target_x = (int)(UnityEngine.Random.value * 100) % width;
        target_z = (int)(UnityEngine.Random.value * 100) % height;
        pos_vect = rb.position;
        /*dest_vect = new Vector3(target_x, rb.position.y, target_z);
        nma.SetDestination(dest_vect);*/
        newDestination();
    }