Example #1
0
        public Agent()
        {
            AgentId         = CurrentAgentId++;
            MaxForceSqared  = MaxForce * MaxForce;
            MaxSpeedSquared = MaxSpeed * MaxSpeed;
            Position        = new Vector2(FlockTools.GetRandomFloat(SirFlocksalotGame.ScreenSize.X), FlockTools.GetRandomFloat(SirFlocksalotGame.ScreenSize.Y));
            float QuarterSpeed = MaxSpeed * 0.25f;

            Velocity    = FlockTools.GetRandomVector2(-QuarterSpeed, QuarterSpeed, -QuarterSpeed, QuarterSpeed);
            Orientation = Velocity.Heading();
        }
Example #2
0
 private void CreateHistory()
 {
     for (int i = Past.Count - 1; i >= 0; i--)
     {
         Past[i].Color.A -= 5;
         if (Past[i].Color.A < 5)
         {
             Past.RemoveAt(i);
         }
     }
     if (Past.Count > 0)
     {
         int   index       = FlockTools.GetRandomInteger(Past.Count);
         Color PickedColor = FlockTools.Pick(new List <Color> {
             Color.DarkSeaGreen, Color.DarkTurquoise, Color.DarkRed, Color.LightYellow, Color.White, Color.FloralWhite
         }) * 0.5f;
         PickedColor.A     = Past[index].Color.A;
         Past[index].Color = PickedColor;
     }
     Past.Add(new PastPosition()
     {
         Position = Position + FlockTools.GetRandomVector2(-2, 2, -2, 2), Color = Color.White
     });
 }