예제 #1
0
        void GenerateRoads()
        {
            MassiveTile t    = TerrainContainer.GetComponent <MassiveTile>();
            string      data = File.ReadAllText(Paths.GetPath(ePATHSPEC.ROADSPATH));
            //t.GenerateRoadsJSON(data);
            GameObject  go = new GameObject("roads");
            MassiveRoad r  = go.AddComponent <MassiveRoad>();

            r.SetMaterial(MajorRoadMaterial, RoadMaterial, PathMaterial, RailwayMaterial);
            go.transform.parent        = TerrainContainer.transform;
            go.transform.localPosition = Vector3.zero;
            r.Generate(data, t.PositionMeters, Paths.GetPath(ePATHSPEC.ROADSASSETPATH));
            DestroyImmediate(r);

            AssetTools.WriteMeshAssets(go, Paths.GetPath(ePATHSPEC.ROADSASSETPATH));
        }
예제 #2
0
        void GenerateBuildings()
        {
            MassiveTile t    = TerrainContainer.GetComponent <MassiveTile>();
            string      data = File.ReadAllText(Paths.GetPath(ePATHSPEC.BUILDINGSPATH));
            //t.GenerateRoadsJSON(data);
            Transform o = TerrainContainer.transform.Find("buildings");

            if (o != null)
            {
                GameObject.DestroyImmediate(o.gameObject);
            }
            GameObject      go = new GameObject("buildings");
            MassiveBuilding b  = go.AddComponent <MassiveBuilding>();

            b.SetMaterial(BuildingMaterial, RoofMaterial);
            go.transform.parent        = TerrainContainer.transform;
            go.transform.localPosition = Vector3.zero;
            b.Generate(data, go, t.PositionMeters);
            //DestroyImmediate(b);

            AssetTools.WriteMeshAssets(go, Paths.GetPath(ePATHSPEC.BUILDINGSASSETPATH));
        }
예제 #3
0
        void GenerateWater()
        {
            MassiveTile t = TerrainContainer.GetComponent <MassiveTile>();

            t.WaterMaterial = this.WaterMaterial;

            if (File.Exists(Paths.GetPath(ePATHSPEC.WATERPATH)))
            {
                string     data = File.ReadAllText(Paths.GetPath(ePATHSPEC.WATERPATH));
                GameObject go   = new GameObject();
                go.transform.parent = t.transform;
                go.name             = "water";
                MassiveWater w = go.AddComponent <MassiveWater>();
                w.OceanMaterial = WaterMaterial;
                //Ocean o = go.AddComponent<Ocean>();
                //o.m_oceanMat = WaterMaterial;
                //o.MainCamera = Camera.main;
                w.GenerateWaterJSON(data, go, t.PositionMeters);
                go.transform.localPosition = Vector3.zero;
                DestroyImmediate(w);

                AssetTools.WriteMeshAssets(go, Paths.GetPath(ePATHSPEC.WATERASSETPATH));
            }
        }
예제 #4
0
        void GenerateRoadNetwork()
        {
            CreateFolders();

            MassiveTile t    = TerrainContainer.GetComponent <MassiveTile>();
            string      data = File.ReadAllText(Paths.GetPath(ePATHSPEC.ROADSPATH));
            Transform   rn   = TerrainContainer.transform.Find("roadnetwork");

            if (rn != null)
            {
                GameObject.DestroyImmediate(rn.gameObject);
            }
            GameObject go = new GameObject("roadnetwork");

            go.transform.parent        = TerrainContainer.transform;
            go.transform.localPosition = Vector3.zero;
            go.layer = LayerMask.NameToLayer("Roads");
            MassiveRoadNetwork mr = go.AddComponent <MassiveRoadNetwork>();

            mr.SetMaterials(RoadMaterial, RailwayMaterial, PathMaterial, ServiceRoadMaterial);
            mr.CreateRoads(data, t.PositionMeters);
            AssetTools.WriteMeshAssets(go, Paths.GetPath(ePATHSPEC.ROADSASSETPATH));
            //mr.CreateTest();
        }