コード例 #1
0
        public void Add(DrawObject obj, bool refreshWhenAdded = false)
        {
            graphicsList.Insert(0, obj);

            obj.ID   = GetNextDrawObjectID();
            obj.Name = obj.Prefix + obj.ID.ToString();

            OnDrawObjsChanged(new ArrayChangedEventArgs <DrawObject>(obj, ArrayChangedType.ItemAdded, refreshWhenAdded));
        }
コード例 #2
0
ファイル: GraphicsList.cs プロジェクト: xuanximoming/PIC
 public void Add(DrawObject obj)
 {
     // insert to the top of z-order
     graphicsList.Insert(0, obj);
 }
コード例 #3
0
        //OBLICZENIA
        public void Update()
        {
            Globals.newKeyState = Keyboard.GetState();

            if (!isLoaded)
            {
                OnLoad();
                isLoaded = true;
            }
            if (KeypressTest(Keys.Escape))
            {
                Globals.activeState = Globals.enGameStates.PAUSE;
            }


            for (int i = 0; i < UpdateList.Count(); i++)
            {
                UpdateList[i].Update();
            }
            Draw();


            if (getCountOfChildrenFlies() == 0)

            {
                ResetState();

                Globals.winner = "SPIDER!";
            }
            else if (getCountOfChildrenFlies() > 150)
            {
                ResetState();


                Globals.winner = "BUTTERFLY!";
            }


            //FLOWER
            if (!IfDrawListHasFlower())
            {
                counter2 = 0;
                if (counter1 < 60 * 3)
                {
                    counter1++;
                }
                else
                {
                    DrawList.Insert(20, new Flower(this, GenerateNewPositionForFlower()));
                }
            }
            else
            {
                counter1 = 0;
                if (counter2 < 60 * 8)
                {
                    counter2++;
                }
                else
                {
                    counter2 = 0;
                    DrawList.Remove(DrawList.Find(x => x is Flower));
                    DrawList.Insert(20, new Flower(this, GenerateNewPositionForFlower()));
                }
            }
            Globals.oldKeyState = Globals.newKeyState;
        }