예제 #1
0
 public Vehicle(Vehicle target, SB sb)
 {
     this.sb = sb;
     mass = World.Instance.random.Next(20, 80);
     max_force = 20;
     max_speed = 10;
     velocity = new Vector2D(5, 5);
     acceleration = Vector2D.None();
     heading = Vector2D.Normalize(velocity);
     CurrentPosition = new Vector2D(World.Instance.random.Next(World.Instance.ClientSize.Width), World.Instance.random.Next(World.Instance.ClientSize.Height));
     steerForce = Vector2D.None();
     brushVehicle = Brushes.Red;
     brushTarget = Brushes.Blue;
     whitePen = Pens.White;
     this.target = target;
 }
예제 #2
0
        private void DemoSeek()
        {
            target = new Vehicle(null, Vehicle.SB.None);
                target.MaxSpeed = 0;
                target.CurrentPosition = new Vector2D(ClientSize.Width / 2, ClientSize.Height / 2);

                agents = new List<Vehicle>();
                agents.Add(target);    //  target of seek

                for (int i = 1; i < numberOfVehicles; i++)
                {
                    agents.Add(new Vehicle(target, Vehicle.SB.Seek));
                }
        }
예제 #3
0
        private void DemoWander()
        {
            target = new Vehicle(null, Vehicle.SB.Wander);
                target.MaxSpeed = 2;
                target.CurrentPosition = new Vector2D(ClientSize.Width / 2, ClientSize.Height / 2);

                agents = new List<Vehicle>();
                agents.Add(target);    //  leader

                for (int i = 1; i < numberOfVehicles; i++)
                {
                    agents.Add(new Vehicle(agents[i - 1], Vehicle.SB.Arrive));
                }
        }
예제 #4
0
        private void DemoExplore()
        {
            target = new Vehicle(null, Vehicle.SB.Explore);
                target.MaxSpeed = 5;
                target.CurrentPosition = new Vector2D(25, 0);

                agents = new List<Vehicle>();
                agents.Add(target);    //  target of seek
        }