Ejemplo n.º 1
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;
        }