Exemplo n.º 1
0
        /// <summary>
        /// Инициирует взаимодействие объектов
        /// </summary>
        public void ProcessObjects()
        {
            if (Children.Count > 0)
            {
                foreach (GameObject o in Children)
                {
                    Objects.Add(o);
                }
                Children.Clear();
            }

            if (Objects.Count > 0)
            {
                foreach (GameObject o in Objects)
                {
                    o.Process();
                }
            }

            if (Trash.Count > 0)
            {
                foreach (GameObject o in Trash)
                {
                    Objects.Remove(o);
                }
                Trash.Clear();
            }
        }
Exemplo n.º 2
0
        override internal void DrawCard(int n)
        {
            Random seed = new Random(DateTime.Now.Second);
            Random r    = new Random(seed.Next(10000));
            int    k;

            for (int j = 0; j < n; j++)
            {
                if (Deck.Count <= 0)
                {
                    Deck.AddRange(Trash);
                    Trash.Clear();
                    GetForm().Invoke(new AddDeckDelegate(ShowTrash.AddDeck), 820, 10 + 120 * num);
                }
                k = r.Next(Deck.Count);
                Hand.Add(Deck[k]);
                GetForm().Invoke(new ShowHandDelegate(ShowCard), Deck[k], 820, 10 + 120 * num);
                Deck.Remove(Deck[k]);
            }
        }
Exemplo n.º 3
0
        public TrashObj[] Buy()
        {
            Trash currTrash = currUser == null ? publicTrash : currUser.sTrash;

            System.Collections.Generic.List <TrashObj> toBuy = new System.Collections.Generic.List <TrashObj>(currTrash.Length);
            for (int i = 0; i < currTrash.Length; ++i)
            {
                if (currTrash[i].stored is Book)
                {
                    if (cargo.Remove(currTrash[i].stored) != null)
                    {
                        toBuy.Add(new TrashObj(currTrash[i].stored, currTrash[i].cnt));
                    }
                    else
                    {
                        toBuy.Add(new TrashObj(currTrash[i].stored, 0));
                    }
                }
            }
            currTrash.Clear();
            return(toBuy.ToArray());
        }