public Pokeball(Model model1, GraphicsDevice device, Camera camera) : base(model1) { this.model = model1; mousePick = new MousePick(device, camera); initPosition = new Vector3(0, 0, 0); translation = Matrix.CreateTranslation(initPosition); }
/// <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, 50, -100), new Vector3(0, 0, 0), Vector3.Up); Components.Add(camera); modelManager = new ModelManager(this); Components.Add(modelManager); //Updated Code text = new Text(this); Components.Add(text); IsMouseVisible = true; base.Initialize(); }
public FleeTank(Model model, GraphicsDevice device, Camera camera, Vector3 position, int tankID) : base(model) { mousePick = new MousePick(device, camera); npcTankID = tankID; //position = new Vector3(100, 0, -100); //enemy tank's spawn position this.position = position; currentVelocity = Vector3.Normalize(new Vector3(0, 0, 1)); //enemy tank is facing vector3(0,0,1) when it spawn, this is initial velocity turretBone = model.Bones["turret_geo"]; backWheelBone = model.Bones["r_back_wheel_geo"]; //9-11 patrol RandomPatrolPoint(); translation = Matrix.CreateTranslation(position); }
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 * Getworld()* GetTranslation(camera); effect.World = transforms[mesh.ParentBone.Index] * Getworld() * GetTranslation(camera); effect.View = camera.view; effect.Projection = camera.projection; effect.TextureEnabled = true; effect.Alpha = 1; } mesh.Draw(); } }
public Tank(Model model, GraphicsDevice device, Camera camera) : base(model) { mousePick = new MousePick(device, camera); tankCamera = camera; position = Vector3.Zero; pickPositionCur = Vector3.Zero; tankDirection = new Vector3(0, 0, 1); tankDirection.Normalize(); //update 9/3 currentCameraDirection = tankCamera.cameraDirection; pickPositionCur = Vector3.Zero; turretBone = model.Bones["turret_geo"]; //update 9/4 00:22 cannonBone = model.Bones["canon_geo"]; lSteerEngineBone = model.Bones["l_steer_geo"]; rSteerEngineBone = model.Bones["r_steer_geo"]; leftBackWheelBone = model.Bones["l_back_wheel_geo"]; rightBackWheelBone = model.Bones["r_back_wheel_geo"]; leftFrontWheelBone = model.Bones["l_front_wheel_geo"]; rightFrontWheelBone = model.Bones["r_front_wheel_geo"]; hatchBone = model.Bones["hatch_geo"]; tankBone = model.Bones["tank_geo"]; leftFrontWheelTransform = leftFrontWheelBone.Transform; rightFrontWheelTransform = rightFrontWheelBone.Transform; leftBackWheelTransform = leftBackWheelBone.Transform; rightBackWheelTransform = rightBackWheelBone.Transform; leftFrontWheelTransform = leftFrontWheelBone.Transform; hatchTransform = hatchBone.Transform; tankTransform = tankBone.Transform; prevMouseState = Mouse.GetState(); }
public override void Draw(GraphicsDevice device, Camera camera) { base.Draw(device, camera); }
protected override Matrix GetTranslation(Camera camera) { float positionX = camera.cameraPosition.X; float positionZ = camera.cameraPosition.Z; return Matrix.CreateTranslation(positionX, 0, positionZ); }
public override void Draw(GraphicsDevice device, Camera camera) { device.SamplerStates[0] = SamplerState.LinearClamp; base.Draw(device, camera); }
public MousePick(GraphicsDevice device, Camera camera) { this.device = device; this.camera = camera; }
protected virtual Matrix GetTranslation(Camera camera) { return translation; }
public Box(Model model, GraphicsDevice device, Camera camera) : base(model) { translation.Translation = new Vector3(1000, 0, 500); }
public boxtexture(Model model, GraphicsDevice device, Camera camera) : base(model) { translation.Translation = new Vector3(-500, 0, -500); }