Example #1
0
    void Start()
    {
        define = FindObjectOfType <DefineWayPoints>();

        for (int x = 0; x < 20; x++)
        {
            posX = 0;
            for (int y = 0; y < 20; y++)
            {
                posX = x * 4;
                posY = y * 4;

                val = grid[x, y];

                switch (val)
                {
                case "0":
                    Instantiate(land, new Vector3(posX, 0, posY), Quaternion.identity);
                    break;

                case "1":
                    Instantiate(road, new Vector3(posX, 0, posY), Quaternion.identity);
                    break;
                }

                if (val.Length >= 2)
                {
                    GameObject wayPoint = Instantiate(wayRoad, new Vector3(posX, 0, posY), Quaternion.identity);
                    wayPoint.name = val;
                }
            }
        }

        define.GenerateList();
    }
Example #2
0
 private void Start()
 {
     define             = GameObject.Find("WayPoints").GetComponent <DefineWayPoints>();
     _wayPoints         = define.GetWayPoints();
     transform.position = _wayPoints[0].transform.position + new Vector3(0f, 1f, 0f);
 }