Esempio n. 1
0
            public CreateRoadMeshScripts.MeshSet GetMeshSet()
            {
                var meshSet = new List <CreateRoadMeshScripts.MeshSet>();

                CreateRoadMeshScripts.CreateArea(positionList, (obj) => meshSet.Add(obj));
                var unitMeshSet = CreateRoadMeshScripts.GetCombinedMesh(meshSet)[0];

                unitMeshSet = BeefMain.Runtime.CreateNodeRoad.ConvertUvSetting(unitMeshSet);
                var addDesign = new List <CreateRoadMeshScripts.MeshSet>();

                addDesign.Add(unitMeshSet);
                addDesign.Add(CreateDesign(positionList));
                return(CreateRoadMeshScripts.GetCombinedMesh(addDesign)[0]);
            }
Esempio n. 2
0
        public static void CreateRoadByNodeMap(NodeMap nodeMap, Action <CreateRoadMeshScripts.MeshSet, string, string> createMeshGameObject)
        {
            var hash         = new HashSet <string>();
            var roadMeshSets = new List <CreateRoadMeshScripts.MeshSet>();
            var areaMeshSets = new List <CreateRoadMeshScripts.MeshSet>();
            var groupDict    = new NodeMap.GroupDict();

            NodeMap.Group(nodeMap, out groupDict);

            foreach (var entry in groupDict)
            {
                // FIXME: 1つ以上のグループが存在する場合の暫定対処, 警告だけ出して処理続行する.
                if (entry.Value != 0)
                {
                    Debug.LogWarningFormat("More than one Node groups exist.");
                    continue;
                }

                CreateRoadMeshFromNode(nodeMap.nodeMap, entry.Key, hash,
                                       CreateRoadMeshScripts.CreateAddToMeshSetListCallback(roadMeshSets)
                                       );
                CreateCrossRoadMeshFromNode(nodeMap.nodeMap, entry.Key,
                                            CreateRoadMeshScripts.CreateAddToMeshSetListCallback(areaMeshSets)
                                            );
            }

            roadMeshSets = CreateRoadMeshScripts.GetCombinedMesh(roadMeshSets);

            for (int i = 0; i < roadMeshSets.Count; i++)
            {
                createMeshGameObject(roadMeshSets[i], "Road" + i, "TileMaterial");
            }

            areaMeshSets = CreateRoadMeshScripts.GetCombinedMesh(areaMeshSets.ConvertAll(ConvertUvSetting));

            for (int i = 0; i < areaMeshSets.Count; i++)
            {
                createMeshGameObject(areaMeshSets[i], "CrossRoad" + i, "CrossTileMaterial");
            }
        }
Esempio n. 3
0
        public static void CreateRoadByNodeMapNext(NodeMap nodeMap, Action <CreateRoadMeshScripts.MeshSet, string, string> createMeshGameObject)
        {
            var hash          = new Dictionary <string, BeefMeshUtility.IPlaneMeshSet>();
            var roadMeshSets  = new List <BeefMeshUtility.IPlaneMeshSet>();
            var curveMeshSets = new List <BeefMeshUtility.IPlaneMeshSet>();
            var areaMeshSets  = new List <BeefMeshUtility.IPlaneMeshSet>();
            var groupDict     = new NodeMap.GroupDict(nodeMap.nodeMap.Count);

            NodeMap.Group(nodeMap, out groupDict);

            foreach (var entry in groupDict)
            {
                // FIXME: 1つ以上のグループが存在する場合の暫定対処, 警告だけ出して処理続行する.
                if (entry.Value != 0)
                {
                    Debug.LogWarningFormat("More than one Node groups exist.");
                    continue;
                }

                CreateRoadMeshFromNodeLine(nodeMap.nodeMap, entry.Key, hash, roadMeshSets);
                var key1       = entry.Key;
                var centerNode = nodeMap.nodeMap[key1];

                if (1 < centerNode.Graph.Count)
                {
                    var connectedMeshSets = centerNode.Graph.ConvertAll((string key2) => key1 + ":" + key2).ConvertAll((string input) => hash[input]).ToList();
                    var meshSet           = BeefMeshUtility.GetFrameMeshSet(connectedMeshSets);

                    if (meshSet == null)
                    {
                        continue;
                    }

                    if (centerNode.Graph.Count == 2)
                    {
                        curveMeshSets.Add(meshSet);
                    }
                    else
                    {
                        areaMeshSets.Add(meshSet);
                    }
                }
            }

            var roadMeshSetsNeo = CreateRoadMeshScripts.GetCombinedMesh(roadMeshSets.ConvertAll((input) => input.GetMeshSet()));

            for (int i = 0; i < roadMeshSetsNeo.Count; i++)
            {
                createMeshGameObject(roadMeshSetsNeo[i], "Road" + i, "TileMaterial");
            }

            var curveMeshSetsNeo = CreateRoadMeshScripts.GetCombinedMesh(curveMeshSets.ConvertAll((input) => input.GetMeshSet()));

            for (int i = 0; i < curveMeshSetsNeo.Count; i++)
            {
                createMeshGameObject(curveMeshSetsNeo[i], "Curve" + i, "CurveTileMaterial");
            }

            var areaMeshSetsNeo = CreateRoadMeshScripts.GetCombinedMesh(areaMeshSets.ConvertAll((input) => input.GetMeshSet()));

            for (int i = 0; i < areaMeshSetsNeo.Count; i++)
            {
                createMeshGameObject(areaMeshSetsNeo[i], "CrossRoad" + i, "CrossTileMaterial");
            }
        }