Exemplo n.º 1
0
    void chonk(int xLoc, int zLoc)      //feed cords like 0,0 5,2    transform.cord / chunk size
    {
        bool skip = false;

        try                  //find if chunk has already been generated, to not re make current existing chunks
        {
            GameObject.Find(xLoc + " " + zLoc).SetActive(true);
            skip = true;
        }
        catch (NullReferenceException) {}



        //create new chunk

        if (skip == false)
        {
            /*
             * grid[xLoc,zLoc] = Instantiate (terrain, new Vector3 (0, 0, 0), Quaternion.identity);
             *
             * grid[xLoc,zLoc].transform.SetParent(this.transform);
             * grid[xLoc,zLoc].name = xLoc + " " + zLoc;
             *
             *
             *
             * grid[xLoc,zLoc].transform.position = new Vector3 (size * xLoc, 0, size * zLoc);
             *
             * Map_Gen loc = grid[xLoc,zLoc].GetComponent<Map_Gen> ();
             *
             * loc.xLocation = map.xSize * xLoc;
             * loc.zLocation = map.zSize * zLoc;
             *
             * loc.Player = Player;
             *
             */


            GameObject tr = Instantiate(terrain, new Vector3(0, 0, 0), Quaternion.identity);
            tr.transform.SetParent(this.transform);
            tr.name = xLoc + " " + zLoc;
            Map_Gen loc = tr.GetComponent <Map_Gen> ();

            tr.transform.position = new Vector3(size * xLoc, 0, size * zLoc);

            loc.xLocation = map.xSize * xLoc;
            loc.zLocation = map.zSize * zLoc;

            loc.Player = Player;
            loc.World  = this.gameObject;
        }
    }
Exemplo n.º 2
0
    void Start()
    {
        LoadInts();

        map = gameObject.GetComponent <Map_Gen>();

        createObj(BigRock, bigRocks, 1, true);
        createObj(BigFlint, bigFlints, 1, true);
        createObj(BigOre, bigOres, 1, true);

        createObj(tree[0], (trees + 1) / 2, 0);
        createObj(tree[1], (trees + 1) / 2, 0);

        createObj(log, logs, 2);
        createObj(small_rock, small_rocks, 1);
        createObj(grass, grasses, 2);
        createObj(flint, flints, 1);
        createObj(bushes, busheses, 2);

        createObj(flower, flowers, 2);
    }