Пример #1
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     device.SamplerStates[0] = SamplerState.LinearClamp;
        skybox= Matrix.CreateScale(1000f)* Matrix.CreateTranslation(camera.cameraPosition.X,0,camera.cameraPosition.Z);
     //skybox = Matrix.CreateScale(300f) * Matrix.CreateTranslation((camera.cameraPosition) - new Vector3(0, 150, 0));
     base.Draw(device, camera);
 }
Пример #2
0
 public Tank(Model model,GraphicsDevice device,Camera camera)
     : base(model)
 {
     mousepick = new MousePick(device, camera);
     turretBone = model.Bones["turret_geo"];
     rightfrontwheel = model.Bones["r_front_wheel_geo"];
     rightbackwheel = model.Bones["r_back_wheel_geo"];
     leftfrontwheel = model.Bones["l_front_wheel_geo"];
     leftbackwheel = model.Bones["l_back_wheel_geo"];
     rightsteergeo = model.Bones["r_steer_geo"];
     leftsteergeo = model.Bones["l_steer_geo"];
     hatchgeo = model.Bones["hatch_geo"];
     canongeo = model.Bones["canon_geo"];
     leftBackWheelTransform = leftbackwheel.Transform;
     rightBackWheelTransform = rightbackwheel.Transform;
     leftFrontWheelTransform = leftfrontwheel.Transform;
     rightFrontWheelTransform = rightfrontwheel.Transform;
     leftSteerTransform = leftsteergeo.Transform;
     rightSteerTransform = rightsteergeo.Transform;
     turretTransform = turretBone.Transform;
     hatchTransform = hatchgeo.Transform;
     canonTransform = canongeo.Transform;
     currentAngle = MathHelper.PiOver2;
     currentPosition = new Vector3(0, 0, 0);
     tankBox = new BoundingBox(MIN, MAX);
 }
Пример #3
0
 public pursuit(Model model, GraphicsDevice device, Camera camera)
     : base(model,device,camera)
 {
     tankBox = new BoundingBox(MIN, MAX);
     currentPosition= new Vector3(-500, 0, -500);
     translation = Matrix.CreateTranslation(currentPosition);
     velocity = new Vector3(1, 0, 1);
     new Tank(model, device, camera);
 }
Пример #4
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     camera = new Camera(this,new Vector3(0,25,150),new Vector3(0,25,0), Vector3.Up);
     Components.Add(camera);
        modelManger = new ModelManager(this);
        Components.Add(modelManger);
     this.IsMouseVisible = true;
     base.Initialize();
 }
Пример #5
0
        protected override void Initialize()
        {
            camera = new Camera(this, new Vector3(800, 400, 900), new Vector3(0, 50, 0), Vector3.Up);
            Components.Add(camera);

            modelManager = new ModelManager(this);
            Components.Add(modelManager);

            this.IsMouseVisible = true;

            base.Initialize();
        }
Пример #6
0
        public virtual void Draw(GraphicsDevice device, Camera camera)
        {
            Matrix[] transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);

            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.World = transforms[mesh.ParentBone.Index] * GetWorld();
                    effect.View = camera.view;
                    effect.Projection = camera.projection;
                    effect.TextureEnabled = true;
                }
                mesh.Draw();
            }
        }
Пример #7
0
 public virtual void Draw(GraphicsDevice device,Camera camera)
 {
     device.BlendState = BlendState.Opaque;
     device.DepthStencilState = DepthStencilState.Default;
     Matrix[] transforms = new Matrix[model.Bones.Count];
     model.CopyAbsoluteBoneTransformsTo(transforms);
     foreach (ModelMesh mesh in model.Meshes)
     {
         foreach (BasicEffect effect in mesh.Effects)
         {
             // effect.World = mesh.ParentBone.Transform*GetWorld();
             effect.World = transforms[mesh.ParentBone.Index] * GetWorld();
             effect.View = camera.view;
             effect.Projection = camera.projection;
             effect.TextureEnabled = true;
             effect.Alpha = 1;
         }
         mesh.Draw();
     }
 }
Пример #8
0
 public Tank(Model model,GraphicsDevice device,Camera camera)
     : base(model)
 {
     mousepick = new MousePick(device, camera);
     turretBone = model.Bones["turret_geo"];
     rightfrontwheel = model.Bones["r_front_wheel_geo"];
     rightbackwheel = model.Bones["r_back_wheel_geo"];
     leftfrontwheel = model.Bones["l_front_wheel_geo"];
     leftbackwheel = model.Bones["l_back_wheel_geo"];
     rightsteergeo = model.Bones["r_steer_geo"];
     leftsteergeo = model.Bones["l_steer_geo"];
     hatchgeo = model.Bones["hatch_geo"];
     canongeo = model.Bones["canon_geo"];
     leftBackWheelTransform = leftbackwheel.Transform;
     rightBackWheelTransform = rightbackwheel.Transform;
     leftFrontWheelTransform = leftfrontwheel.Transform;
     rightFrontWheelTransform = rightfrontwheel.Transform;
     leftSteerTransform = leftsteergeo.Transform;
     rightSteerTransform = rightsteergeo.Transform;
     turretTransform = turretBone.Transform;
     hatchTransform = hatchgeo.Transform;
     canonTransform = canongeo.Transform;
     currentPosition = prePosition;
 }
Пример #9
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     Matrix wheelRotation = Matrix.CreateRotationX(wheelRotationValue);
      Matrix steerRotation = Matrix.CreateRotationY(steerRotationValue);
      Matrix turretRotation = Matrix.CreateRotationY(turretRorationValue);
      Matrix canonRotation = Matrix.CreateRotationX(canonRotationValue);
      Matrix hatchRotation = Matrix.CreateRotationX(hatchRotationValue);
      leftbackwheel.Transform = wheelRotation * leftBackWheelTransform;
      rightbackwheel.Transform = wheelRotation * rightBackWheelTransform;
      leftfrontwheel.Transform = wheelRotation * leftFrontWheelTransform;
      rightfrontwheel.Transform = wheelRotation * rightFrontWheelTransform;
      leftsteergeo.Transform = steerRotation * leftSteerTransform;
      rightsteergeo.Transform = steerRotation * rightSteerTransform;
      hatchgeo.Transform = hatchRotation * hatchTransform;
      turretBone.Transform = turretRotation * turretTransform;
     base.Draw(device, camera);
 }
Пример #10
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     base.Draw(device, camera);
 }
Пример #11
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     device.SamplerStates[0] = SamplerState.LinearWrap;
     base.Draw(device, camera);
 }
Пример #12
0
 public MousePick(GraphicsDevice device, Camera camera)
 {
     this.device = device;
     this.camera = camera;
 }