Ejemplo n.º 1
0
        public override void Create()
        {
            // first make our base verts that we will copy
            if (baseVerts == null)
            {
                baseVerts = gameObject.AddComponent <MeshVerts>();
            }
            baseVerts.mesh = mesh;

            SafeInsert(baseVerts);

            /*
             *
             *  Our gooey stuff
             *
             */

            // set up the things we will need to make our gooey verts
            if (body == null)
            {
                body = gameObject.AddComponent <Body>();
            }
            if (gooeyTransfer == null)
            {
                gooeyTransfer = gameObject.AddComponent <Life>();
            }
            if (gooeyVerts == null)
            {
                gooeyVerts = gameObject.AddComponent <MeshVerts>();
            }
            if (triangles == null)
            {
                triangles = gameObject.AddComponent <MeshTris>();
            }


            gooeyTransfer.shader     = gooeyTransferShader;
            gooeyTransfer.kernelName = gooeyTransferKernel;

            // setting up the meshes
            gooeyVerts.mesh   = mesh;
            triangles.toIndex = gooeyVerts;

            // setting up the body
            body.verts     = gooeyVerts;
            body.triangles = triangles;
            body.material  = bodyMaterial;

            //using a transform binder to get our info into gooey transform
            if (bindTransform == null)
            {
                bindTransform = gameObject.AddComponent <BindTransform>();
            }
            bindTransform.toBind = gooeyTransfer;


            //using a position binder to get our disformer into gooey transform
            if (bindPosition == null)
            {
                bindPosition = gameObject.AddComponent <BindPosition>();
            }
            bindPosition.toBind         = gooeyTransfer;
            bindPosition.boundTransform = disformer;
            bindPosition.boundName      = disformerNameInShader;


            // Body is going to add our verts and tris for us!
            SafeInsert(body);
            SafeInsert(gooeyTransfer);
            SafeInsert(bindTransform);
            SafeInsert(bindPosition);


            /*
             *
             *  Particles On Our Gooey Stuff!
             *
             */

            // set up the stuff to place particles on those gooey verts
            if (particles == null)
            {
                particles = gameObject.AddComponent <ParticlesOnDynamicMesh>();
            }
            if (anchorTransfer == null)
            {
                anchorTransfer = gameObject.AddComponent <Life>();
            }

            particles.count = numAnchorParticles;
            particles.mesh  = mesh;


            anchorTransfer.shader     = anchorTransferShader;
            anchorTransfer.kernelName = anchorTransferKernel;

            SafeInsert(particles);
            SafeInsert(anchorTransfer);


            /*
             *  Turning our particles into pretty renders
             */

            if (particleBody == null)
            {
                particleBody = gameObject.AddComponent <Body>();
            }
            if (particleTransferVerts == null)
            {
                particleTransferVerts = gameObject.AddComponent <ParticleTransferVerts>();
            }
            if (particleTransferTris == null)
            {
                particleTransferTris = gameObject.AddComponent <ParticleTransferTris>();
            }
            if (particleBodyTransfer == null)
            {
                particleBodyTransfer = gameObject.AddComponent <Life>();
            }

            particleBodyTransfer.shader     = particleBodyTransferShader;
            particleBodyTransfer.kernelName = particleBodyTransferKernel;

            particleTransferVerts.particles = particles;
            particleTransferTris.toIndex    = particleTransferVerts;


            // setting up the body
            particleBody.verts     = particleTransferVerts;
            particleBody.triangles = particleTransferTris;
            particleBody.material  = particleMaterial;

            // Body is going to add verts and tris for us!
            SafeInsert(particleBody);
            SafeInsert(particleBodyTransfer);
        }
Ejemplo n.º 2
0
 public void BindLandData(Life toBind)
 {
 }
Ejemplo n.º 3
0
 public void BindCameraData(Life toBind)
 {
     toBind.BindVector3("_CameraForward", () => this.camera.forward);
     toBind.BindVector3("_CameraUp", () => this.camera.up);
     toBind.BindVector3("_CameraRight", () => this.camera.right);
 }
Ejemplo n.º 4
0
 public void BindRayData(Life toBind)
 {
 }
Ejemplo n.º 5
0
 public void BindPlayerData(Life toBind)
 {
     // toBind.BindForm("_HumanBuffer",humans);
 }