public Player(ContentManager content, Map map, FirstPersonCamera cam) { prevmous = Mouse.GetState(); bullets = new List <Bullet>(); this.bulletmodel = content.Load <Model>("Models/bullet"); this.map = map; this.cam = cam; }
public Player(ContentManager content,Map map,FirstPersonCamera cam) { prevmous = Mouse.GetState(); bullets = new List<Bullet>(); this.bulletmodel = content.Load<Model>("Models/bullet"); this.map = map; this.cam = cam; }
public Map(ContentManager content, FirstPersonCamera cam) { Blocks = new List <Sprite3D>(); images = new List <Image3D>(); map = new List <string>(); this.content = content; this.cam = cam; }
public Map(ContentManager content,FirstPersonCamera cam) { Blocks = new List<Sprite3D>(); images = new List<Image3D>(); map = new List<string>(); this.content = content; this.cam = cam; }
public PlayState(GameStateManager gsm, ContentManager content) : base(gsm, content) { keyb = Keyboard.GetState(); cam = new FirstPersonCamera(Vector3.Zero, Vector3.Zero, Consts.WORLDSCALE/15f, 0.001f); map = new Map(content,cam); map.setLevel(1); cam.setMap(map); player = new Player(content, map,cam); }
public Bullet(Model model,FirstPersonCamera cam) { shape = new Sprite3D(model); this.cam = cam; shape.setPosition(cam.getPosition()); shape.setScale(Consts.WORLDSCALE / 10f); float dx = cam.getLookAt().X - shape.getPosition().X; float dy = cam.getLookAt().Y - shape.getPosition().Y; float dz = cam.getLookAt().Z - shape.getPosition().Z; float d = (float)(Math.Sqrt(dx * dx + dy * dy + dz * dz)); this.velocity = new Vector3(dx / d * Consts.BULLETSPEED, dy / d * Consts.BULLETSPEED, dz / d * Consts.BULLETSPEED); }
public PlayState(GameStateManager gsm, ContentManager content) : base(gsm, content) { keyb = Keyboard.GetState(); cam = new FirstPersonCamera(Vector3.Zero, Vector3.Zero, Consts.WORLDSCALE / 15f, 0.001f); map = new Map(content, cam); map.setLevel(1); cam.setMap(map); player = new Player(content, map, cam); }
public Bullet(Model model, FirstPersonCamera cam) { shape = new Sprite3D(model); this.cam = cam; shape.setPosition(cam.getPosition()); shape.setScale(Consts.WORLDSCALE / 10f); float dx = cam.getLookAt().X - shape.getPosition().X; float dy = cam.getLookAt().Y - shape.getPosition().Y; float dz = cam.getLookAt().Z - shape.getPosition().Z; float d = (float)(Math.Sqrt(dx * dx + dy * dy + dz * dz)); this.velocity = new Vector3(dx / d * Consts.BULLETSPEED, dy / d * Consts.BULLETSPEED, dz / d * Consts.BULLETSPEED); }
public void draw(FirstPersonCamera cam) { Matrix[] transforms = new Matrix[model.Bones.Count]; model.CopyAbsoluteBoneTransformsTo(transforms); foreach (ModelMesh mesh in model.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.EnableDefaultLighting(); effect.World = transforms[mesh.ParentBone.Index] * getWorld(); effect.View = cam.getView(); effect.Projection = cam.projection; } mesh.Draw(); } }
private void drawMatrix(FirstPersonCamera cam, Matrix world) { effect.EnableDefaultLighting(); effect.LightingEnabled = true; effect.World = world; effect.View = cam.getView(); effect.Projection = cam.projection; effect.Texture = texture; effect.TextureEnabled = true; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); effect.GraphicsDevice.SamplerStates[0] = SamplerState.LinearClamp; effect.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, vertices, 0, 2); } }
public void draw(FirstPersonCamera camera) { drawMatrix(camera, getWorld()); drawMatrix(camera, getWorldReversed()); }