Пример #1
0
 public void Clear()
 {
     QuadrocoptersList.Clear();
     Threads.Clear();
     GPSMechanic.Position      = new Vector(-75, 100);
     GPSMechanic.Velocity      = Vector.Zero;
     AirscrewMechanic.Position = new Vector(-75, 100);
     AirscrewMechanic.Velocity = Vector.Zero;
     LightsMechanic.Position   = new Vector(-75, 100);
     LightsMechanic.Velocity   = Vector.Zero;
     foreach (Thread t in Threads)
     {
         t.Abort();
     }
 }
Пример #2
0
        public void AddQuadrocopter()
        {
            Random       r = new Random();
            Quadrocopter q = new Quadrocopter(new Operator("оператор " + QuadrocoptersList.Count.ToString()),
                                              new Vector(r.Next(0, (int)(Width * 0.4f)), r.Next(65, (int)(Height * 0.4f))), QuadrocoptersList.Count + 1);

            q.LightsAreOff    += LightsMechanic.RepairAsync;
            q.GPSCrash        += GPSMechanic.RepairAsync;
            q.AirscrewCrashed += AirscrewMechanic.RepairAsync;
            QuadrocoptersList.Add(q);
            Thread t = new Thread(() => q.Update(this))
            {
                IsBackground = true
            };

            Threads.Add(t);
        }