예제 #1
0
        public void update()
        {
            updateSphere();
            //posicionActual = esfera.Position;
            posicionActual = municion.Position;
            float x;
            float z;
            float y;

            //if ((bool)GuiController.Instance.Modifiers.getValue("boundingBox"))
            //esfera.BoundingBox.render();

            velocidad = (float)GuiController.Instance.Modifiers.getValue("speedShoot");
            x         = direccion.X * velocidad * GuiController.Instance.ElapsedTime;
            y         = 0;
            z         = direccion.Z * velocidad * GuiController.Instance.ElapsedTime;

            Vector3 vMove = new Vector3(x, y, z);

            //esfera.move(vMove);
            municion.move(vMove);

            if (sonidoShoot)
            {
                sonidoShoot = false;
            }
        }
예제 #2
0
        /// <param name="elapsedTime">Tiempo en segundos transcurridos desde el último frame</param>
        public override void render(float elapsedTime)
        {
            float moveForward = 0;
            float jump        = 0;



            //Device de DirectX para renderizar
            Device d3dDevice = GuiController.Instance.D3dDevice;


            //conviene deshabilitar ambas camaras para que no haya interferencia

            //Capturar Input teclado
            if (GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.F))
            {
                moveForward = 100 * elapsedTime;
                //Tecla F apretada
            }

            if (GuiController.Instance.D3dInput.keyDown(Microsoft.DirectX.DirectInput.Key.Space))
            {
                jump = 100 * elapsedTime;
            }

            //Capturar Input Mouse
            if (GuiController.Instance.D3dInput.buttonPressed(TgcViewer.Utils.Input.TgcD3dInput.MouseButtons.BUTTON_LEFT))
            {
                //Boton izq apretado
            }

            Vector3 movementVector = new Vector3(
                FastMath.Sin(sphere.Rotation.Y) * moveForward,
                jump,
                FastMath.Cos(sphere.Rotation.Y) * moveForward
                );

            Vector3 realMovement = collisionManager.moveCharacter(sphere.BoundingSphere, movementVector, objetosColisionables);

            sphere.move(realMovement);

            sphere.updateValues();
            scene.renderAll();
            sphere.render();
            GuiController.Instance.RotCamera.CameraCenter = sphere.Position;

            //Mover Auto
            //mainCar.elapsedTime = elapsedTime;
            //mainCar.Mover();
            //

            //mainCar.meshAuto.render();
            //SetCarCamera();
        }
예제 #3
0
 private void moveTo(Vector3 movimiento)
 {
     sphere.move(movimiento);
     box.move(movimiento);
 }
예제 #4
0
 public override void move(Vector3 move)
 {
     mesh.move(move);
     updateBB();
 }