public void Draw(SpriteBatch spritebatch, Camera camera, Texture2D smokecloud)
 {
     float scale = camera.Scale(smokecloud,particlesize);
     //Coursepress
     //color fades to 0
     spritebatch.Draw(smokecloud, camera.Converttovisualcoords(currentpos, smokecloud), null, color, rotation, randomdirection, scale, SpriteEffects.None, 0);
 }
        public Tank1(Model model, GraphicsDevice device, Camera camera)
            : base(model)
        {
            mousePick = new MousePicking(device, camera);
            //载入模型
            turretBone = model.Bones["turret_geo"];
            canonBone = model.Bones["canon_geo"];
            lbackwheelBone = model.Bones["l_back_wheel_geo"];
            rbackwheelBone = model.Bones["r_back_wheel_geo"];
            lfrontwheelBone = model.Bones["l_front_wheel_geo"];
            rfrontwheelBone = model.Bones["r_front_wheel_geo"];
            lsteergeoBone = model.Bones["l_steer_geo"];
            rsteergeoBone = model.Bones["r_steer_geo"];
            hatchgeo = model.Bones["hatch_geo"];

            //赋值给每个部件的变换
            leftBackWheelTransform = lbackwheelBone.Transform;
            rightBackWheelTransform = rbackwheelBone.Transform;
            leftFrontWheelTransform = lfrontwheelBone.Transform;
            rightFrontWheelTransform = rfrontwheelBone.Transform;
            leftSteerTransform = lsteergeoBone.Transform;
            rightSteerTransform = rsteergeoBone.Transform;
            turretTransform = turretBone.Transform;
            hatchTransform = hatchgeo.Transform;
            canonTransform = canonBone.Transform;
        }
Example #3
0
        public override void Draw(GraphicsDevice device, Camera camera)
        {
            translation = Matrix.CreateTranslation(-38,-190, -80);
            world = Matrix.CreateScale(2f);

            base.Draw(device, camera);
        }
Example #4
0
 public ModelManager(Game game, Camera camera, HeightMapInfo heightMapInfo)
     : base(game)
 {
     this.game = game;
     this.camera = camera;
     heightmapCollision = new HeightmapCollision(heightMapInfo);
 }
 public Shockwave(Texture2D _shockwavetexture, SpriteBatch _spritebatch, Camera _camera, Vector2 _startpos)
 {
     camera = _camera;
     spritebatch = _spritebatch;
     shockwavetexture = _shockwavetexture;
     currentPos = _startpos;
 }
Example #6
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     SamplerState ss = new SamplerState();
     ss.AddressU = TextureAddressMode.Wrap;
     ss.AddressV = TextureAddressMode.Wrap;
     device.SamplerStates[0] = ss;
     base.Draw(device, camera);
 }
        public void Draw(SpriteBatch spritebatch, Camera camera,Texture2D smokecloud)
        {
            spritebatch.Begin();

            foreach (Smokeparticle smoke in particles)
            {
                smoke.Draw(spritebatch, camera, smokecloud);
            }
            spritebatch.End();
        }
 public SplitterSystem(Texture2D spark,SpriteBatch _spritebatch,Camera _camera,float _scale,Vector2 _startlocation)
 {
     spritebatch = _spritebatch;
     camera = _camera;
     scale = _scale;
     startpos = _startlocation;
     while(particles.Count <maxparticles)
     {
         particles.Add(new SplitterParticle(spark, rand, spritebatch, camera, scale, startpos, lifetime));
     }
 }
        public Explosion(Texture2D _explosiontexture,SpriteBatch _spritebatch,Camera _camera,float _scale,Vector2 _startpos)
        {
            camera = _camera;
            spritebatch = _spritebatch;
            explosion = _explosiontexture;
            currentPos = _startpos;
            scale = _scale;

            timeElapsed = 0;
            explosionwidth = _explosiontexture.Width / numframesX;
            explosionheight = _explosiontexture.Height / numframesY;
        }
        public Smokesystem(Texture2D _smokeTexture, SpriteBatch _spritebatch,Camera _camera,Vector2 _startlocation)
        {
            smoketexture = _smokeTexture;
            spritebatch = _spritebatch;
            camera = _camera;

            startlocation = _startlocation;
            if (particles.Count < numberofsmokes)
            {
                particles.Add(new Smokeparticle(smoketexture, rand, lifetimeofsmoke,startlocation));
            }
        }
Example #11
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()
        {
            //draw = new Draw(this, graphics);
            //draw.SetupScreen(1440, 900);

            camera = new Camera(new Vector3(5f, 5f, 5f), 0, GraphicsDevice.Viewport.AspectRatio, 0.05f, 100f);
            effect = new BasicEffect(GraphicsDevice);
            maze = new Maze(GraphicsDevice);

            //Call base
            base.Initialize();
        }
Example #12
0
        public void Draw(Camera camera, BasicEffect effect)
        {
            effect.VertexColorEnabled = true;
            effect.World = Matrix.Identity;
            effect.View = camera.View;
            effect.Projection = camera.Projection;

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();
                device.SetVertexBuffer(floorBuffer);
                device.DrawPrimitives(PrimitiveType.TriangleList, 0, floorBuffer.VertexCount / 3);
            }
        }
Example #13
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
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Setup.graphicsDevice = GraphicsDevice;
            Setup.contentManager = Content;
            Setup.spriteBatch = spriteBatch;

            camera = new Camera(GraphicsDevice.Viewport);
            //camera.Parallax = new Vector2(1.0f, 1.0f);
           
            base.Initialize();
        }
        public SplitterParticle(Texture2D _spark, Random _rand, SpriteBatch _spritebatch, Camera _camera, float _scale, Vector2 _startpos, float _lifetime)
        {
            spark = _spark;
            rand = _rand;
            spritebatch = _spritebatch;
            camera = _camera;
            scale = _scale;
            startpos = _startpos;
            lifetime = _lifetime;

            randomdirection = new Vector2((float)rand.NextDouble() - 0.5f, (float)rand.NextDouble() - 0.7f);
            //normalize to get it spherical vector with length 1.0
            randomdirection.Normalize();
            randomdirection = randomdirection * ((float)rand.NextDouble() * maxspeed);
            velocity = randomdirection * scale;
        }
        public Applicationview(ContentManager _content,Camera _camera,SpriteBatch _spritebatch)
        {
            content = _content;
            camera = _camera;
            spritebatch = _spritebatch;

            splittertexture = content.Load<Texture2D>("spark");
            smoketexture = content.Load<Texture2D>("smoke");
            explosiontexture = content.Load<Texture2D>("explosion");
            shockwavetexture = content.Load<Texture2D>("Shockwave");

            splittersystem = new SplitterSystem(splittertexture, spritebatch, camera, scale, startpos);
            smokesystem = new Smokesystem(smoketexture, spritebatch, camera, startpos);

            explosion = new Explosion(explosiontexture, spritebatch, camera, scale, startpos);
            shockwave = new Shockwave(shockwavetexture, spritebatch, camera, startpos);
        }
Example #16
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();
            }
        }
Example #17
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     device.SamplerStates[0] = SamplerState.LinearClamp;
     Matrix[] skyboxTransforms = new Matrix[model.Bones.Count];
     model.CopyAbsoluteBoneTransformsTo(skyboxTransforms);
     foreach (ModelMesh mesh in model.Meshes)
     {
         foreach (BasicEffect currenteffect in mesh.Effects)
         {
             currenteffect.World = mesh.ParentBone.Transform * GetWorld() * Matrix.CreateTranslation(camera.cameraPosition);
             currenteffect.View = camera.view;
             currenteffect.Projection = camera.projection;
             currenteffect.TextureEnabled = true;
         }
         mesh.Draw();
     }
 }
Example #18
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 = mesh.ParentBone.Transform * rotation * world * movement  * translation; // * scaling matrix
                    effect.View = camera.view;
                    effect.Projection = camera.projection;
                    effect.TextureEnabled = true;
                }
                mesh.Draw();
            }
        }
Example #19
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()
        {
            playerPosition = new Vector3(0f, 3f, 5f);
            targetPosition = new Vector3(0f, 3f, 0f);

            // TODO: Add your initialization logic here
            IsMouseVisible = true;
            camera = new Camera(this, playerPosition, targetPosition, Vector3.Up);
              //     cube = new Sphere(this, camera);
            Components.Add(camera);
               // Components.Add(cube);

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

            base.Initialize();
        }
Example #20
0
 public PursuitEnemy(Model model, Vector3 position,GraphicsDevice device, Camera camera,Tank tank)
     : base(model, device, camera)
 {
     tankBox = new BoundingBox(MIN, MAX);
     CurrentPosition = position;
     pickPosition = CurrentPosition;
     translation = Matrix.CreateTranslation(Map.MapToWorld(new Point(10, 10)));
     velocity = Vector3.Zero;
     new Tank(model, device, camera);
     steer = new Steering(100f, 100f);
     map = new Map();
     pathfinder = new Pathfinder(map);
     isMoving = false;
     initialAngle = MathHelper.PiOver2;
     moveorder = 0;
     mousepick = new MousePicking(device, camera);
     targetTank = tank;
 }
Example #21
0
        public Tank(Model model, GraphicsDevice device, Camera camera)
            : base(model)
        {
            this.tankcamera = camera;
            mousePick = new MousePicking(device, camera);
            currentCameraDirection = tankcamera.cameraDirection;
            //载入模型
            turretBone = model.Bones["turret_geo"];
            canonBone = model.Bones["canon_geo"];
            lbackwheelBone = model.Bones["l_back_wheel_geo"];
            rbackwheelBone = model.Bones["r_back_wheel_geo"];
            lfrontwheelBone = model.Bones["l_front_wheel_geo"];
            rfrontwheelBone = model.Bones["r_front_wheel_geo"];
            lsteergeoBone = model.Bones["l_steer_geo"];
            rsteergeoBone = model.Bones["r_steer_geo"];
            hatchgeo = model.Bones["hatch_geo"];

            //赋值给每个部件的变换
            leftBackWheelTransform = lbackwheelBone.Transform;
            rightBackWheelTransform = rbackwheelBone.Transform;
            leftFrontWheelTransform = lfrontwheelBone.Transform;
            rightFrontWheelTransform = rfrontwheelBone.Transform;
            leftSteerTransform = lsteergeoBone.Transform;
            rightSteerTransform = rsteergeoBone.Transform;
            turretTransform = turretBone.Transform;
            hatchTransform = hatchgeo.Transform;
            canonTransform = canonBone.Transform;
            //rotation = Matrix.CreateRotationY(MathHelper.Pi);

            initialAngle = MathHelper.PiOver2;
            //tankBox = new BoundingBox(MIN, MAX);
            //CurrentPosition = Vector3.Zero;
        }
Example #22
0
 public Ground(Model model, Camera camera)
     : base(model, camera)
 {
 }
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     device.SamplerStates[0] = SamplerState.LinearWrap;
     base.Draw(device, camera);
 }
Example #24
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, 0, 5), Vector3.Zero, new Vector3(0, 1, 0));
            Components.Add(camera);

            base.Initialize();
        }
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     base.Draw(device, camera);
 }
Example #26
0
 public override void Draw(GraphicsDevice device, Camera camera)
 {
     world = Matrix.CreateTranslation(0, -2.25f, 0);
     base.Draw(device, camera);
 }
 public MousePicking(GraphicsDevice graphicDevice, Camera camera)
 {
     this.graphicDevice = graphicDevice;
     this.camera = camera;
 }
Example #28
0
        public override void Draw(GraphicsDevice device, Camera camera)
        {
            //rbackwheelBone.Transform = Matrix.CreateRotationX(MathHelper.PiOver4 / 4) * rbackwheelBone.Transform;

            Matrix wheelRotation = Matrix.CreateRotationX(wheelRotationValue);
            //Matrix steerRotation = Matrix.CreateRotationY(steerRotationValue);
            Matrix turretRotation = Matrix.CreateRotationY(turretRotationValue);
            Matrix canonRotation = Matrix.CreateRotationX(canonRotationValue);
            Matrix hatchRotation = Matrix.CreateRotationX(hatchRotationValue);
            lbackwheelBone.Transform = wheelRotation * leftBackWheelTransform;
            rbackwheelBone.Transform = wheelRotation * rightBackWheelTransform;
            lfrontwheelBone.Transform = wheelRotation * leftFrontWheelTransform;
            rfrontwheelBone.Transform = wheelRotation * rightFrontWheelTransform;
            //leftSteerTransform = steerRotation * leftSteerTransform;
            //rightSteerTransform = steerRotation * rightSteerTransform;
            hatchgeo.Transform = hatchRotation * hatchTransform;
            turretBone.Transform = turretRotation * turretTransform;
            canonBone.Transform = canonRotation * canonTransform;
                base.Draw(device, camera);
        }
Example #29
0
 public ModelManager(Game game, Camera camera)
     : base(game)
 {
     this.game = game;
     this.camera = camera;
 }
Example #30
0
 public Bowl(Model model, Camera camera)
     : base(model, camera)
 {
 }