예제 #1
0
    void Start()
    {
        _terrian              = new Terrian(size);
        Game.Instance.Planet  = this;
        Game.Instance.Terrian = _terrian;

        chunks = GetComponent <Chunks> ();
        Debug.Assert(chunks != null);

        water = GetComponent <Water> ();
        Debug.Assert(water != null);

        var center = new Vector3(-size / 2, -size / 2, -size / 2) + (new Vector3() * 0.5f);

        gameObject.transform.position = center;

        Terrian.Generate();

        trees          = new Trees(this, _terrian);
        trees.treesNum = treesNum;

        if (!hideTrees)
        {
            trees.Generate();
        }

        loadData();

        chunks.UpdateMesh();
        water.Load(chunks);
    }