コード例 #1
0
ファイル: WorldUI.cs プロジェクト: JustTeRoR/Task4and5
        public async void PayFactory(object o)
        {
            while (true)
            {
                if (RocketList.Count == 0)
                {
                    return;
                }

                if (Agents.Count > 0)
                {
                    var r      = o as Rocket;
                    var rocket = RocketList.Find(x => x.LogicObj.Equals(r));

                    var m = await Agents.ReceiveAsync();

                    if (m != null && rocket != null)
                    {
                        Thread.Sleep(1500);
                        if (RocketList.Contains(rocket))
                        {
                            m.DoWork(rocket.LogicObj);
                            Rocket_Dead(r);
                        }
                    }
                    Agents.Post(m);
                    return;
                }
                else
                {
                    Thread.Sleep(1000);
                }
            }
        }