Esempio n. 1
0
        void Additions()
        {
            while (true)
            {
                if (Cars.Count < 6 && r.Next(0, 1000) > 500 && !HasCrash)
                {
                    Cars.Add(new Car(r.Next(0, 1000) > 500, !CurLight));
                    LightChangedEvent += Cars.Last().ChangeState;
                }
                Thread.Sleep(1000);

                if (Ppl.Count < 4 && r.Next(0, 1000) > 500 && !HasCrash)
                {
                    Ppl.Add(new Man(r.Next(0, 1000) > 500, CurLight)
                    {
                        X = r.Next(162, 260)
                    });
                    LightChangedEvent += Ppl.Last().ChangeState;
                }
                Thread.Sleep(1200);
            }
        }
Esempio n. 2
0
 public void RemovePerson(Person person)
 {
     person.Unsettle();
     Ppl.Remove(person);
 }
Esempio n. 3
0
 void RemoveMan(Man m)
 {
     m.CurThread.Abort();
     LightChangedEvent -= m.ChangeState;
     Ppl.Remove(m);
 }
Esempio n. 4
0
 public void AddPerson(Person person)
 {
     Ppl.Add(person);
     person.Settle(this);
 }