public void Draw(GameTime gameTime, FirstPersonCamera camera) { foreach (ModelMesh modelMesh in skinnedModel.Model.Meshes) { foreach (ModelMeshPart meshPart in modelMesh.MeshParts) { XNAnimation.Effects.SkinnedModelBasicEffect basicEffect = (XNAnimation.Effects.SkinnedModelBasicEffect)meshPart.Effect; Vector3 RenderPos = camera.Position; RenderPos.Y -= 110.0f; basicEffect.World = Matrix.CreateScale(SCALE, SCALE, SCALE) * Matrix.CreateRotationY((float)Math.PI + (float)Math.PI*camera.HeadingDegrees/180.0f) * Matrix.CreateTranslation(RenderPos); basicEffect.Bones = animationController.SkinnedBoneTransforms; basicEffect.View = Game1.Player.camera.ViewMatrix; basicEffect.Projection = Game1.Player.camera.ProjectionMatrix; // OPTIONAL - Configure material basicEffect.Material.DiffuseColor = new Vector3(0.8f); basicEffect.Material.SpecularColor = new Vector3(0.3f); basicEffect.Material.SpecularPower = 8; basicEffect.NormalMapEnabled = enableNormalTexture; basicEffect.SpecularMapEnabled = false; // OPTIONAL - Configure lights basicEffect.AmbientLightColor = new Vector3(0.1f); basicEffect.LightEnabled = true; basicEffect.EnabledLights = XNAnimation.Effects.EnabledLights.One; basicEffect.PointLights[0].Color = Vector3.One; basicEffect.PointLights[0].Position = new Vector3(100, 100, 100); } modelMesh.Draw(); } }
public Being(Demo Game) { this.Game = Game; GunList = new ArrayList(); GunList.Add(new Gun(7, 28, (int)Guns.Deagle, Game.Deagle)); GunList.Add(new Gun(30, 90, (int)Guns.AK47, Game.AK47)); GunList.Add(new Gun(8, 24, (int)Guns.Shotty, Game.Shotty)); CurrentGun = (int)Guns.Deagle; camera = new FirstPersonCamera(Game); Health = CurrentHealth = 100; timeToChangeDirection = Environment.TickCount; StarScore = 0; TimeOfLastDeath = Environment.TickCount; model = Game.Leet; }
private void PerformCameraCollisionDetection(FirstPersonCamera camera) { Vector3 newPos = camera.Position; if (camera.Position.X > CAMERA_BOUNDS_MAX_X) newPos.X = CAMERA_BOUNDS_MAX_X; if (camera.Position.X < CAMERA_BOUNDS_MIN_X) newPos.X = CAMERA_BOUNDS_MIN_X; if (camera.Position.Y > CAMERA_BOUNDS_MAX_Y) newPos.Y = CAMERA_BOUNDS_MAX_Y; if (camera.Position.Y < CAMERA_BOUNDS_MIN_Y) newPos.Y = CAMERA_BOUNDS_MIN_Y; if (camera.Position.Z > CAMERA_BOUNDS_MAX_Z) newPos.Z = CAMERA_BOUNDS_MAX_Z; if (camera.Position.Z < CAMERA_BOUNDS_MIN_Z) newPos.Z = CAMERA_BOUNDS_MIN_Z; camera.Position = newPos; }
public Demo() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; camera = new FirstPersonCamera(this); Components.Add(camera); Components.Add(new GamerServicesComponent(this)); Window.Title = "Sunshine Slashers"; IsFixedTimeStep = false; }