예제 #1
0
        /// <inheritdoc />
        public void BuildMesh(Tile tile, Mesh mesh)
        {
            EnsureTile(tile);

            var gameObject = new GameObject(mesh.Name);

            var uMesh = new UnityEngine.Mesh();

            uMesh.vertices  = mesh.Vertices;
            uMesh.triangles = mesh.Triangles;
            uMesh.colors    = mesh.Colors;
            uMesh.uv        = mesh.Textures;

            uMesh.RecalculateNormals();

            gameObject.isStatic = true;
            gameObject.AddComponent <MeshFilter>().mesh             = uMesh;
            gameObject.AddComponent <MeshRenderer>().sharedMaterial =
                _customizationService.GetSharedMaterial(@"Materials/Default");
            gameObject.AddComponent <MeshCollider>();
            gameObject.transform.parent = tile.GameObject.transform;
        }
예제 #2
0
 private Material GetMaterial(Element element)
 {
     return(_customizationService.GetSharedMaterial("Materials/" + element.Styles["material"]));
 }