public override void Draw(GameTime gameTime, GraphicsDeviceManager graphics, SpriteBatch spriteBatch) { graphics.GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(); _escaper.Draw(spriteBatch, Manager.DebugState); _pursuer.Draw(spriteBatch, Manager.DebugState); // Add a Line in heading direction for DEBUG if (Manager.DebugState == true) { Tools.Graphics.GraphicsHelper.DrawLine ( graphics.GraphicsDevice, spriteBatch, _escaper.Pos, _escaper.Behavior.wanderTargetPos, Color.IndianRed, 3 ); // Wandering circle SteeringBehavior b = _escaper.Behavior; wanderCircle = Tools.Graphics.GraphicsHelper.CreateCircle((int)b.WanderingRadius, graphics.GraphicsDevice, Color.Black); spriteBatch.Draw(wanderCircle, b.wanderCirclePos, null, Color.Black * 1.0f, 0.0f, new Vector2(wanderCircle.Width / 2, wanderCircle.Height / 2), Vector2.One, SpriteEffects.None, 1); Tools.Graphics.GraphicsHelper.DrawLine ( graphics.GraphicsDevice, spriteBatch, _pursuer.Pos, _pursuer.Pos + _pursuer.Heading * _pursuer.ViewDistance, Color.IndianRed, 3 ); } spriteBatch.End(); }
public Vehicle(Game1 world, Vector2 position, Vector2 velocity, float mass, float maxSpeed, float maxForce, Vector2 scale, Color color ) : base(position, velocity, mass, maxSpeed, maxForce, scale) { _world = world; _behavior = new SteeringBehavior(this); Active = true; // Create textures _color = color; LoadContent(_world.Content, @"Graphics/Ghost"); // Add bounding radius BRadius = Math.Max(_sprite.Width * Scale.X, _sprite.Height * Scale.Y); BrakeRadius = 5; }