Exemplo n.º 1
0
        public override void Initialize()
        {
            Instance = this;

            foreach (var f in fieldsList)
            {
                fieldDic[f.FieldWorkerType] = f;
            }
        }
Exemplo n.º 2
0
        public void Setup(float fieldSize, FieldDictionary dictionary = null)
        {
            var dic = dictionary ?? FieldDictionary.Instance;

            var terrainData = Instantiate(dic.BaseTerrainData);
            var height      = dic.GetHeight(fieldSize);

            terrainData.heightmapResolution = dic.GetResolution(fieldSize);
            terrainData.size = new Vector3(fieldSize, height, fieldSize);

            Debug.LogFormat("size:{0} resolution:{1}", terrainData.size, terrainData.heightmapResolution);

            terrain.terrainData  = terrainData;
            collider.terrainData = terrainData;
        }
Exemplo n.º 3
0
        public void Setup(float fieldSize, FieldDictionary dictionary = null)
        {
            var dic = dictionary ?? FieldDictionary.Instance;

            var terrainData = terrain.terrainData ?? Instantiate(dic.BaseTerrainData);
            var height      = dic.GetHeight(fieldSize);

            terrainData.heightmapResolution = dic.GetResolution(fieldSize);
            terrainData.size = new Vector3(fieldSize, height, fieldSize);

            //Debug.LogFormat("size:{0} resolution:{1}", terrainData.size, terrainData.heightmapResolution);

            terrain.terrainData  = terrainData;
            collider.terrainData = terrainData;

            var builder = this.GetComponent <AsyncNavMeshBuilder>();

            if (builder != null)
            {
                builder.SetData(terrainData.bounds.center, terrainData.bounds.size);
                builder.StartBake();
                //Debug.Log("BuildNavMesh");
            }
        }