Beispiel #1
0
 public RuntimeSurfaceGeometryModule_Polygon(
     LevelEntity_Polygon polygonEntity,
     LevelEntity_Polygon.DataSources dataSource,
     Mesh surfaceMesh,
     MeshRenderer surfaceRenderer) : base()
 {
     this.polygonEntity = polygonEntity;
     this.dataSource    = dataSource;
     SurfaceMesh        = surfaceMesh;
     SurfaceRenderer    = surfaceRenderer;
 }
        public virtual void InitializeRuntimeSurface(
            LevelEntity_Polygon entity,
            LevelEntity_Polygon.DataSources dataSource)
        {
            if (geometryModule != null)
            {
                throw new Exception("Cannot initialize surface more than once.");
            }

            var mesh = new Mesh();

            gameObject.AddComponent <MeshFilter>().sharedMesh = mesh;

            geometryModule = new RuntimeSurfaceGeometryModule_Polygon(
                entity,
                dataSource,
                mesh,
                gameObject.AddComponent <MeshRenderer>());

            AssembleSurface();
        }