public override void Update(GameTime gameTime) { this.bodyGraphics.OrientationMatrix = base.OrientationMatrix; this.bodyGraphics.Translation = base.Translation; this.bodyGraphics.Update(gameTime); base.Update(gameTime); }
public override void Update(GameTime gameTime) { var t = (float)gameTime.EllapsedGameTime.TotalSeconds; var keyboardState = Game.Keyboard.GetCurrentState(); var mouseState = Game.Mouse.GetCurrentState(); float mouseX = -mouseState.X; float mouseY = -mouseState.Y; LookAt = Vector3.Transform(LookAt, Matrix.RotationY(mouseX * MoveSpeed / 80f)).ToVector3(); LookAt.Normalize(); var lookAtNormal = new Vector3(-LookAt.Z, LookAt.Y, LookAt.X); LookAt = Vector3.Transform(LookAt, Matrix.RotationAxis(lookAtNormal, mouseY * MoveSpeed / 80f)).ToVector3(); var q = Vector3.Zero; if (keyboardState.IsPressed(Key.W)) { q += Vector3.UnitY * MoveSpeed; } if (keyboardState.IsPressed(Key.S)) { q -= Vector3.UnitY * MoveSpeed; } if (keyboardState.IsPressed(Key.A)) { q -= Vector3.UnitX * MoveSpeed; } if (keyboardState.IsPressed(Key.D)) { q += Vector3.UnitX * MoveSpeed; } if (keyboardState.IsPressed(Key.Q)) { q += Vector3.UnitZ * MoveSpeed * 2; } if (keyboardState.IsPressed(Key.E)) { q -= Vector3.UnitZ * MoveSpeed * 2; } Position += q * t; LookAt = new Vector3(Position.X, Position.Y, 0); UpdateMatrices(); //System.Windows.Forms.Cursor.Position = new Point(200, 200); base.Update(gameTime); }
public override void Draw(GameTime gameTime) { if (Settings.GraphicsSettings.VisibleViewTriangle) this.viewTriangleGraphics.Draw(gameTime); if (Settings.GraphicsSettings.VisibleSmellingCircle) this.smellingGraphics.Draw(gameTime); if (Settings.GraphicsSettings.VisibleBody) this.bodyGraphics.Draw(gameTime); base.Draw(gameTime); }
public override void Update(GameTime gameTime) { throw new NotImplementedException(); }
public override void Update(GameTime gameTime) { base.Update(gameTime); }
public override void Draw(GameTime gameTime) { base.Draw(gameTime); }
public virtual void Update(GameTime gameTime) { }
public virtual void Draw(GameTime gameTime) { }
public override void Update(GameTime gameTime) { this.UpdateEffect(); base.Update(gameTime); }
public override void Draw(GameTime gameTime) { this.DrawCircle(); base.Draw(gameTime); }
public override void Update(GameTime gameTime) { var t = (float)gameTime.EllapsedGameTime.TotalSeconds; AI(t); this.UpdateGraphics(gameTime); base.Update(gameTime); }
private void UpdateGraphics(GameTime gameTime) { if (Settings.GraphicsSettings.VisibleViewTriangle) { this.viewTriangleGraphics.OrientationMatrix = base.OrientationMatrix; this.viewTriangleGraphics.Translation = base.Translation; this.viewTriangleGraphics.Update(gameTime); // gyors teszt, hogy a kód és a grafika szinkronban van-e var sawHuman = false; foreach (var human in this.Game.World.AsObjects<HumanCharacter>()) { var viewTriangle = GeometryHelper.GetViewTriangle(this.Translation, this.OrientationVector, this.ViewDistance, this.ViewAngle); // beware, ez most csak akkor detektál, ha az ember középpontja (origója) a háromszögbe esik // nem elég, ha metszik a háromszög a kört if (CollisionHelper.IsPointInTriangle(human.Translation, viewTriangle)) { sawHuman = true; break; } } if (sawHuman) this.viewTriangleGraphics.Color = Color.White; else this.viewTriangleGraphics.Color = Color.Green; } if (Settings.GraphicsSettings.VisibleSmellingCircle) { this.smellingGraphics.Translation = base.Translation; this.smellingGraphics.Update(gameTime); // gyors teszt, hogy a kód és a grafika szinkronban van-e var smelledHuman = false; foreach (var human in this.Game.World.AsObjects<HumanCharacter>()) { var distance = Vector3.Distance(human.Translation, this.Translation); if (distance < (this.SmellingRadius + human.Radius)) { smelledHuman = true; break; } } if (smelledHuman) this.smellingGraphics.Color = Color.White; else this.smellingGraphics.Color = Color.Green; } if (Settings.GraphicsSettings.VisibleBody) { this.bodyGraphics.OrientationMatrix = base.OrientationMatrix; this.bodyGraphics.Translation = base.Translation; this.bodyGraphics.Update(gameTime); } }
public override void Draw(GameTime gameTime) { this.bodyGraphics.Draw(gameTime); base.Draw(gameTime); }