コード例 #1
0
        //TGCSphere vida;  //si uso sphere funciona, con mesh no

        public Vida( )
        {
            body = FactoryBody.crearBodyEsfericoEstatico(new TGCVector3(1300f, 360f, 1500f), radio);

            #region configurarEfecto
            efecto = TgcShaders.loadEffect(GameModel.shadersDir + "shaderPlanta.fx");
            #endregion

            #region configurarObjeto

            vida           = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\vida-TgcScene.xml").Meshes[0];
            vida.Scale     = new TGCVector3(20.5f, 10.5f, 20.5f);
            vida.Effect    = efecto;
            vida.Technique = "RenderScene";
            vida.RotateY(90);
            //vida.Transform = new TGCMatrix(body.InterpolationWorldTransform);
            //vida.UpdateMeshTransform();

            //var texture = TgcTexture.createTexture(D3DDevice.Instance.Device, GameModel.mediaDir + "texturas\\terrain\\NormalMapMar.png");
            //vida = new TGCSphere(1, texture.Clone(), TGCVector3.Empty);
            ////Tgc no crea el vertex buffer hasta invocar a update values.
            //vida.updateValues();

            objetos.Add(vida);
            //glowObjects.Add(vida);

            #endregion
        }
コード例 #2
0
        public Zombie(TGCVector3 posicion, GameLogic logica)
        {
            body     = FactoryBody.crearBodyZombie(new TGCVector3(posicion.X, posicion.Y + 350, posicion.Z));
            callback = new CollisionCallbackZombie(logica, this);

            #region configurarEfecto
            var d3dDevice = D3DDevice.Instance.Device;
            efecto = TgcShaders.loadEffect(GameModel.shadersDir + "shaderPlanta.fx");
            //Texture bumpMap = TextureLoader.FromFile(d3dDevice, GameModel.mediaDir + "texturas\\terrain\\NormalMapNieve2.jpg");
            //efecto.SetValue("NormalMap", bumpMap);
            #endregion

            #region configurarObjeto
            zombie           = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\Zombie7-TgcScene.xml").Meshes[0];
            zombie.Scale     = new TGCVector3(55.5f, 55.5f, 55.5f);
            zombie.Position  = posicion;
            zombie.Effect    = efecto;
            zombie.Technique = "RenderScene";

            objetos.Add(zombie);

            globo           = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\GLOBO-TgcScene.xml").Meshes[0];
            globo.Scale     = new TGCVector3(40.5f, 40.5f, 40.5f);
            globo.Position  = posicion;
            globo.Effect    = efecto;
            globo.Technique = "RenderZombie";

            objetos.Add(globo);

            #endregion

            PostProcess.agregarPostProcessObject(this);
        }
コード例 #3
0
        public Caja(GameLogic logica)//GamePhysics world)
        {
            body = FactoryBody.crearBodyCubico(masa, new TGCVector3(10, 10, 10), new TGCVector3(0, 600, 0));
            var d3dDevice = D3DDevice.Instance.Device;

            //   physicWorld = world;

            #region configurarEfecto
            efecto = TgcShaders.loadEffect(GameModel.shadersDir + "shaderPlanta.fx");
            #endregion

            #region configurarObjeto

            planta          = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\PLANTA-TgcScene.xml").Meshes[0];
            planta.Scale    = new TGCVector3(35.5f, 35.5f, 35.5f);
            planta.Position = new TGCVector3(0, 600f, 0);

            planta.Effect    = efecto;
            planta.Technique = "RenderScene";
            objetos.Add(planta);
            //glowObjects.Add(planta);

            #endregion

            #region CAJA

            //Se crea una caja de tamaño 20 con rotaciones y origien en 10,100,10 y 1kg de masa.
            var boxShape     = new BoxShape(10, 10, 10);
            var boxTransform = TGCMatrix.RotationYawPitchRoll(MathUtil.SIMD_HALF_PI, MathUtil.SIMD_QUARTER_PI, MathUtil.SIMD_2_PI).ToBsMatrix;
            boxTransform.Origin = new TGCVector3(0, 600, 0).ToBsVector;
            DefaultMotionState boxMotionState = new DefaultMotionState(boxTransform);
            //Es importante calcular la inercia caso contrario el objeto no rotara.
            var boxLocalInertia = boxShape.CalculateLocalInertia(1f);
            var boxInfo         = new RigidBodyConstructionInfo(1f, boxMotionState, boxShape, boxLocalInertia);
            body = new RigidBody(boxInfo);

            var texture = TgcTexture.createTexture(D3DDevice.Instance.Device, GameModel.mediaDir + "texturas\\terrain\\NormalMapMar.png");
            //Es importante crear todos los mesh con centro en el 0,0,0 y que este coincida con el centro de masa definido caso contrario rotaria de otra forma diferente a la dada por el motor de fisica.
            // boxMesh = TGCBox.fromSize(new TGCVector3(50, 50, 50), texture);

            #endregion
            callback = new CollisionCallback(logica, this);

            // objetos.Add(boxMesh);
        }
コード例 #4
0
        public ParedFondo(GameLogic logica, Play play)
        {
            #region configurarEfecto
            efecto = TgcShaders.loadEffect(GameModel.shadersDir + "shaderPlanta.fx");
            #endregion

            #region configurarObjeto
            tag           = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\Tag-TgcScene.xml").Meshes[0];
            tag.Scale     = new TGCVector3(500, 500, 500);
            tag.Effect    = efecto;
            tag.Technique = "RenderScene";
            tag.Position  = new TGCVector3(100f, 340f, -3300f);
            tag.RotateZ(90.1f);

            objetos.Add(tag);

            body     = FactoryBody.crearBodyPared(new TGCVector3(4000, 5, 1), new TGCVector3(0f, 215f, -3300f));
            callback = new CollisionCallbackFinal(logica, play);
            logica.addBulletObject(this);
            #endregion

            PostProcess.agregarPostProcessObject(this);
        }
コード例 #5
0
        public Pared(GameLogic logica, float x)
        {
            #region configurarEfecto
            efecto = TgcShaders.loadEffect(GameModel.shadersDir + "shaderPlanta.fx");
            #endregion

            #region configurarObjeto
            tag           = new TgcSceneLoader().loadSceneFromFile(GameModel.mediaDir + "modelos\\Tag-TgcScene.xml").Meshes[0];
            tag.Scale     = new TGCVector3(100, 100, 100);
            tag.Effect    = efecto;
            tag.Technique = "RenderScene";
            tag.Position  = new TGCVector3(x, 440f, -3300f);
            tag.RotateZ(90.1f);

            objetos.Add(tag);

            //x = -850, -150, 550, 1250
            body     = FactoryBody.crearBodyPared(new TGCVector3(150, 50, 50), new TGCVector3(x, 215f, -3300));//new TGCVector3(320, 5, 3300), new TGCVector3(x, 215f, 0));
            callback = new CollisionCallbackWall(logica);
            logica.addBulletObject(this);
            #endregion

            PostProcess.agregarPostProcessObject(this);
        }
コード例 #6
0
 public BalaCongelante(TgcMesh planta, GameLogic logica)
 {
     body = FactoryBody.crearBodyConImpulso(planta.Position, radio, masa, planta.Rotation);
     logica.addBulletObject(this);
     callback = new CollisionCallbackDisparo(logica, this);
 }