コード例 #1
0
ファイル: scene5.cs プロジェクト: stantheman112/ToyRoomGame
        protected override void LoadContent()
        {
            loadScreen = Content.Load<Texture2D>("Images\\gui\\loadscreen");
            loadScreenDraw(loadScreen, new Vector2(-90, -20));
            loadPauseScreen();

            yeah = Content.Load<SoundEffect>("yeah2");
            ohno = Content.Load<SoundEffect>("ohno");
            backgroundMusic = Content.Load<SoundEffect>("ToyRoom");
            indicatorTxt = Content.Load<Texture2D>("Images\\indicator");
            mannTexture = Content.Load<Texture2D>("Images\\theBoy");
            mannTexture2 = Content.Load<Texture2D>("Images\\theBoyShowing");
            mannTexture3 = Content.Load<Texture2D>("Images\\boytup");
            boyDissapointedTxt = Content.Load<Texture2D>("Images\\boytdown");
            roomTexture = Content.Load<Texture2D>("Images\\theroom");
            guiBubbleTxt = Content.Load<Texture2D>("Images\\talkingBubbleLeft");
            basketOpeningTxt = Content.Load<Texture2D>("Images\\wheelBasket2");

            textures[0] = Content.Load<Texture2D>("Images\\sportscar");
            textures[1] = Content.Load<Texture2D>("Images\\theplane");
            textures[2] = Content.Load<Texture2D>("Images\\train");
            textures[3] = Content.Load<Texture2D>("Images\\tractor");
            textures[4] = Content.Load<Texture2D>("Images\\digger");
            textures[5] = Content.Load<Texture2D>("Images\\dino");
            textures[6] = Content.Load<Texture2D>("Images\\baby");
            textures[7] = Content.Load<Texture2D>("Images\\soldier");
            textures[8] = Content.Load<Texture2D>("Images\\actionFigure");
            textures[9] = Content.Load<Texture2D>("Images\\teddy");
            textures[10] = Content.Load<Texture2D>("Images\\block");
            textures[11] = Content.Load<Texture2D>("Images\\ball");
            textures[12] = Content.Load<Texture2D>("Images\\balloon");
            textures[13] = Content.Load<Texture2D>("Images\\colored\\pad");
            textures[14] = Content.Load<Texture2D>("Images\\horse");
            textures[15] = Content.Load<Texture2D>("Images\\racecar");
            textures[16] = Content.Load<Texture2D>("Images\\dumper");

            basketTxt = Content.Load<Texture2D>("Images\\wheelBasket1");

            spriteFont = Content.Load<SpriteFont>("sf20");

            spriteFont = Content.Load<SpriteFont>("sf20");
            spriteFont.LineSpacing = 25;
            spriteFont.Spacing = 1;
            talkingBubble = new GameGUI(this.Game, spriteFont, new Vector2(150, 80), "Please help ! \n Be quick! \n Or more toys \n will come", Color.Black, 0f, new Vector2(0, 0), 1f, 0f);
            talkingBubble.GuiBackgroundRect = guiBubbleRct;
            talkingBubble.GuiBackgroundTxt = guiBubbleTxt;
            talkingBubble.GuiVisible = true;

            talkingBubble.DrawOrder = 10000;

            boy = new BasicComponent(this.Game, mannTexture, mannRect, 0f);
            basketLeft = new BasicComponent(this.Game, basketTxt, basketLeftRect, 0.0f);
            basketRight = new BasicComponent(this.Game, basketTxt, basketRightRect, 0.0f);
            basketOpeningLeft = new BasicComponent(this.Game, basketOpeningTxt, basketOpeningLRct, 0.0f);
            basketOpeningRight = new BasicComponent(this.Game, basketOpeningTxt, basketOpeningRRct, 0.0f);

            roomBackground = new BasicComponent(this.Game, roomTexture, roomRect, Color.White, 0.0f);
            toy = new MoveAbleComponent(this.Game, textures[0], defaultRect, Color.Orange, 0.0f);

            roomBackground.DrawOrder = -100;
            basketLeft.DrawOrder = 200;
            basketRight.DrawOrder = 201;
            basketOpeningLeft.DrawOrder = 198;
            basketOpeningRight.DrawOrder = 197;
            toy.DrawOrder = 199;
            boy.DrawOrder = 100;

            yeahinst = yeah.CreateInstance();
            ohnoinst = ohno.CreateInstance();
            backgroundMusicInst = backgroundMusic.CreateInstance();
            indicator = new BasicComponent(this.Game, indicatorTxt, indicatorRct, Color.White, 0.0f);
            indicator.DrawOrder = 12122;
            indicator.ItemDraw = false;
            Components.Add(indicator);
            Components.Add(roomBackground);

            //for (int i = 0; i < textures.Length; i++)
            //{
            //    addFloorToy(i, i);
            //}

            addToys(420, 450, 0, 700, 300, 330, 0, 700, true, true, 222, 150, true);

            Components.Add(boy);

            Components.Add(basketOpeningRight);
            Components.Add(basketOpeningLeft);
            Components.Add(toy);
            Components.Add(basketLeft);
            Components.Add(basketRight);

            Components.Add(talkingBubble);
            base.LoadContent();
        }
コード例 #2
0
ファイル: Scene7.cs プロジェクト: stantheman112/ToyRoomGame
        protected override void LoadContent()
        {
            loadScreen = Content.Load<Texture2D>("Images\\gui\\loadscreen");
            loadScreenDraw(loadScreen, new Vector2(-90, -20));
            loadPauseScreen();

            yeah = Content.Load<SoundEffect>("yeah2");
            ohno = Content.Load<SoundEffect>("ohno");
            backgroundMusic = Content.Load<SoundEffect>("ToyRoom");
            myBoy = Content.Load<SoundEffect>("goodboy");
            myBoyInst = myBoy.CreateInstance();

            mamaTxt = Content.Load<Texture2D>("Images\\mama");
            mannTexture = Content.Load<Texture2D>("Images\\theBoy");
            mannTexture2 = Content.Load<Texture2D>("Images\\theBoyShowing");
            mannTexture3 = Content.Load<Texture2D>("Images\\boytup");
            boyDissapointedTxt = Content.Load<Texture2D>("Images\\boytdown");
            roomTexture = Content.Load<Texture2D>("Images\\theroom");
            crayonTxt = Content.Load<Texture2D>("Images\\bigcrayonside");
            indicatorTxt = Content.Load<Texture2D>("Images\\indicator");
            guiBubbleTxt = Content.Load<Texture2D>("Images\\talkingBubbleLeft");
            roomdooropen = Content.Load<Texture2D>("Images\\roomdooropen");

            textures[0] = Content.Load<Texture2D>("Images\\sportscar");
            textures[1] = Content.Load<Texture2D>("Images\\theplane");
            textures[2] = Content.Load<Texture2D>("Images\\train");
            textures[3] = Content.Load<Texture2D>("Images\\tractor");
            textures[4] = Content.Load<Texture2D>("Images\\digger");
            textures[5] = Content.Load<Texture2D>("Images\\dino");
            textures[6] = Content.Load<Texture2D>("Images\\baby");
            textures[7] = Content.Load<Texture2D>("Images\\soldier");
            textures[8] = Content.Load<Texture2D>("Images\\actionFigure");
            textures[9] = Content.Load<Texture2D>("Images\\teddy");
            textures[10] = Content.Load<Texture2D>("Images\\block");
            textures[11] = Content.Load<Texture2D>("Images\\ball");
            textures[12] = Content.Load<Texture2D>("Images\\balloon");
            textures[13] = Content.Load<Texture2D>("Images\\colored\\pad");
            textures[14] = Content.Load<Texture2D>("Images\\horse");
            textures[15] = Content.Load<Texture2D>("Images\\racecar");
            textures[16] = Content.Load<Texture2D>("Images\\dumper");

            spriteFont = Content.Load<SpriteFont>("sf20");

            basketTxt = Content.Load<Texture2D>("Images\\wheelBasket1");
            basketOpeningTxt = Content.Load<Texture2D>("Images\\wheelBasket2");

            yeahinst = yeah.CreateInstance();
            ohnoinst = ohno.CreateInstance();
            backgroundMusicInst = backgroundMusic.CreateInstance();

            talkingBubble = new GameGUI(this.Game, spriteFont, new Vector2(185, 130), "Friend! Hurry help!! \n You must be  \n very quick now!!", Color.Black, 0f, new Vector2(0, 0), 1f, 0f);
            talkingBubble.GuiBackgroundRect = guiBubbleRct;
            talkingBubble.GuiBackgroundTxt = guiBubbleTxt;
            talkingBubble.GuiVisible = true;

            boy = new BasicComponent(this.Game, mannTexture, mannRect, 0.0f);
            basketLeft = new BasicComponent(this.Game, basketTxt, basketLeftRect, 0.0f);
            basketOpening = new BasicComponent(this.Game, basketOpeningTxt, basketOpeningRct, Color.White, 0.0f);

            roomBackground = new BasicComponent(this.Game, roomTexture, roomRect, Color.White, 0.0f);
            toy = new MoveAbleComponent(this.Game, textures[0], rectangles[0], Color.Orange, 0.0f);
            mama = new BasicComponent(this.Game, mamaTxt, mamaRct, 0.0f);
            mama.ItemDraw = false;
            indicator = new BasicComponent(this.Game, indicatorTxt, indicatorRct, Color.White, 0.0f);
            indicator.DrawOrder = 12122;
            indicator.ItemDraw = false;
            Components.Add(indicator);
            roomBackground.DrawOrder = -100;
            basketLeft.DrawOrder = 213;
            basketOpening.DrawOrder = 198;
            toy.DrawOrder = 199;
            boy.DrawOrder = 100;
            talkingBubble.DrawOrder = 1112;
            mama.DrawOrder = 20000;
            Components.Add(mama);
            Components.Add(roomBackground);
            toy.CompRectX = 10000;
            addToys(450, 460, 0, 700, 330, 390, 0, 700, true, true, 150, 150, false);
            Components.Add(gameGUI);
            Components.Add(boy);
            Components.Add(basketOpening);
            Components.Add(toy);
            Components.Add(basketLeft);
            crayons = new BasicComponent[4];
            for (int i = 0; i <crayons.Length; i++)
            {
                BasicComponent crayonTemp = new BasicComponent(this.Game, crayonTxt, crayonRect, colorList[i], 0.0f);
                crayonTemp.ItemDraw = true;
                crayonRect.X += 200;
                crayonTemp.DrawOrder = 212;
                crayons[i] = crayonTemp;
                Components.Add(crayonTemp);
            }
            Components.Add(talkingBubble);

            for (int i = 0; i < 20; i++)
            {
                newRand = rnd.Next(0, textures.Length - 1);
                toysBackground.addGraphicItem(newRand, textures[newRand], rectangles[newRand], true, true, 330, 370, 0, 700);
                toysCollected.Add(newRand);
            }

            base.LoadContent();
        }
コード例 #3
0
ファイル: Lobby.cs プロジェクト: stantheman112/ToyRoomGame
        protected override void LoadContent()
        {
            for (int i = 1; i < 7; i++)
            {
                Texture2D tmp, tmpg, tmpcurr;
                tmp = Content.Load<Texture2D>("Images\\gui\\lvl" + i.ToString() + "clear");
                tmpg = Content.Load<Texture2D>("Images\\gui\\lvl" + i.ToString() + "nclear");
                tmpcurr = Content.Load<Texture2D>("Images\\gui\\lvl" + i.ToString() + "curr");
                lvlTxts.Add(tmp);
                lvlTxtsG.Add(tmpg);
                lvlTxtsCurr.Add(tmpcurr);
            }
            lobbyText = Content.Load<Texture2D>("Images\\lobby");
            playBtnText = Content.Load<Texture2D>("Images\\playButton");
            playBtnChngText = Content.Load<Texture2D>("Images\\gui\\playButtonChanged");

            sf50 = Content.Load<SpriteFont>("sf50");

            sf32 = Content.Load<SpriteFont>("sf32");

            int lvlHorPos = 200;
            for (int i = 0; i < 6; i++)
            {
                if (i < sceneProgression)
                {
                    BasicComponent tmplvl = new BasicComponent(this.Game, lvlTxts[i], new Rectangle(lvlHorPos, 112, 80, 88), Color.White, 0.0f);
                    levels.Add(tmplvl);
                    tmplvl.Dispose();

                }
                else if(i > sceneProgression  && (sceneProgression!=0 || i>0))
                {
                    BasicComponent tmplvl = new BasicComponent(this.Game, lvlTxtsG[i], new Rectangle(lvlHorPos, 112, 80, 88), Color.White, 0.0f);
                    levels.Add(tmplvl);
                    tmplvl.Dispose();

                }
                else if (i == sceneProgression || (sceneProgression == 0 && i == 0))
                {
                    BasicComponent tmplvl = new BasicComponent(this.Game, lvlTxtsCurr[i], new Rectangle(lvlHorPos, 112, 80, 88), Color.White, 0.0f);
                    levels.Add(tmplvl);
                    tmplvl.Dispose();
                }

                lvlHorPos = lvlHorPos + 85;
            }

            playButton = new BasicComponent(this.Game, playBtnText, playBtnRect, Color.White, 0.0f);
            lobby = new BasicComponent(this.Game, lobbyText, lobbyRect, 0f);

            Components.Add(lobby);

            for (int i = 0; i < levels.Count; i++)
            {
                levels[i].ComponentType = Convert.ToString(i + 1); ;
                Components.Add(levels[i]);
            }

            Components.Add(playButton);

            if (gameData.getProgression("lobby") == 6)
            {
                playButton.ComponentTexture = playBtnChngText;
                playButton.ComponentRectangle = playBtnChngRct;
            }

            base.LoadContent();
        }
コード例 #4
0
ファイル: Lobby.cs プロジェクト: stantheman112/ToyRoomGame
        protected override void UnloadContent()
        {
            for (int l = 0; l < levels.Count; l++)
               levels[l] = null;
            levels.Clear();
            playButton = null;
            lobby = null;

            Content.Unload();
            Components.Clear();
            gameData = null;
            GC.Collect();

            GC.WaitForPendingFinalizers();

            string test = GC.GetTotalMemory(true).ToString();

            base.UnloadContent();
        }
コード例 #5
0
        protected override void UnloadContent()
        {
            loadScreenDraw(loadScreen, new Vector2(-90, -20));
            accelSensor = null;
            indicator = null;
            basketLeft = null;
            basketOpeningLeft = null;
            basketOpeningLeft = null;
            basketRight = null;
            mama = null;
            boy = null;
            toy = null;
            talkingBubble = null;
            toysCollected = null;
            for (int r = 0; r < rectangles.Count; r++)
                rectangles[r] = Rectangle.Empty;
            Content.Unload();
            Components.Clear();
            rectangles.Clear();
            for (int txt = 0; txt < textures.Count; txt++)
            {
                textures[txt] = null;
            }
            rectangles.Clear();
            textures.Clear();
            GC.Collect();
            GC.WaitForPendingFinalizers();

            string test = GC.GetTotalMemory(true).ToString();
            Debug.WriteLine(test);

            base.UnloadContent();
        }
コード例 #6
0
ファイル: Scene4.cs プロジェクト: stantheman112/ToyRoomGame
        protected override void LoadContent()
        {
            try
            {
                loadScreen = Content.Load<Texture2D>("Images\\gui\\loadscreen");
                loadScreenDraw(loadScreen, new Vector2(-90, -20));

                backgroundMusic = Content.Load<SoundEffect>("ToyRoom");
                yeah = Content.Load<SoundEffect>("yeah2");
                ohno = Content.Load<SoundEffect>("ohno");
                indicatorTxt = Content.Load<Texture2D>("Images\\indicator");

                mannTexture = Content.Load<Texture2D>("Images\\theBoy");
                mannTexture2 = Content.Load<Texture2D>("Images\\theBoyShowing");
                mannTexture3 = Content.Load<Texture2D>("Images\\boytup");
                roomTexture = Content.Load<Texture2D>("Images\\theroom");
                guiBubbleTxt = Content.Load<Texture2D>("Images\\tlkBubble");
                basketOpeningTxt = Content.Load<Texture2D>("Images\\wheelBasket2");

                textures[0] = Content.Load<Texture2D>("Images\\Colored\\sportscar");
                textures[1] = Content.Load<Texture2D>("Images\\Colored\\theplane");
                textures[2] = Content.Load<Texture2D>("Images\\Colored\\train");
                textures[3] = Content.Load<Texture2D>("Images\\Colored\\tractor");
                textures[4] = Content.Load<Texture2D>("Images\\Colored\\digger");
                textures[5] = Content.Load<Texture2D>("Images\\Colored\\dino");
                textures[6] = Content.Load<Texture2D>("Images\\Colored\\baby");
                textures[7] = Content.Load<Texture2D>("Images\\Colored\\soldier");
                textures[8] = Content.Load<Texture2D>("Images\\Colored\\actionFigure");
                textures[9] = Content.Load<Texture2D>("Images\\Colored\\teddy");
                textures[10] = Content.Load<Texture2D>("Images\\Colored\\block");
                textures[11] = Content.Load<Texture2D>("Images\\Colored\\ball");
                textures[12] = Content.Load<Texture2D>("Images\\Colored\\balloon");
                textures[13] = Content.Load<Texture2D>("Images\\Colored\\pad");
                textures[14] = Content.Load<Texture2D>("Images\\Colored\\horse");
                textures[15] = Content.Load<Texture2D>("Images\\Colored\\racecar");
                textures[16] = Content.Load<Texture2D>("Images\\Colored\\dumper");

                basketLeftTxt = Content.Load<Texture2D>("Images\\wheelBasket1");
            }
            catch (Exception ex)
            {
            }

            spriteFont = Content.Load<SpriteFont>("sf20");
            spriteFont.LineSpacing = 25;
            spriteFont.Spacing = 1;

            boy = new BasicComponent(this.Game, mannTexture, mannRect, 0f);
            basketLeft = new BasicComponent(this.Game, basketLeftTxt, basketLeftRect, Color.LightBlue, 0.0f);
            basketOpening = new BasicComponent(this.Game, basketOpeningTxt, basketOpeningRct, Color.LightBlue, 0.0f);
            roomBackground = new BasicComponent(this.Game, roomTexture, roomRect, Color.White, 0.0f);
            toy = new MoveAbleComponent(this.Game, textures[0], defaultRect, Color.White, 0.0f);
            talkingBubble = new GameGUI(this.Game, spriteFont, new Vector2(210, 65), "Hello friend!  \n Please help! \n  Hurry! or more \n toys will come! ", Color.Black, 0f, new Vector2(0, 0), 1f, 0f);
            talkingBubble.GuiBackgroundRect = guiBubbleRct;
            talkingBubble.GuiBackgroundTxt = guiBubbleTxt;
            talkingBubble.GuiVisible = true;

            talkingBubble.DrawOrder = 11127;
            roomBackground.DrawOrder = -100;
            basketLeft.DrawOrder = 200;
            basketOpening.DrawOrder = 198;
            toy.DrawOrder = 199;
            boy.DrawOrder = 100;

            yeahinst = yeah.CreateInstance();
            backgroundMusicInst = backgroundMusic.CreateInstance();

            indicator = new BasicComponent(this.Game, indicatorTxt, indicatorRct, Color.White, 0.0f);
            indicator.DrawOrder = 12122;
            indicator.ItemDraw = false;

            Components.Add(roomBackground);
            addToys(410, 440, 0, 700, 360, 390, 0, 700, true, false, 222, 150, true);

            Components.Add(boy);
            Components.Add(basketOpening);

            Components.Add(toy);
            Components.Add(basketLeft);
            loadPauseScreen();
            Components.Add(indicator);
            Components.Add(talkingBubble);
               // numberOfTurns = textures.Length;
            toy.CompRectX = -10000;
            base.LoadContent();
        }
コード例 #7
0
        protected void loadPauseScreen()
        {
            pauseScreenTxt = Content.Load<Texture2D>("Images\\gui\\pausescreen");
             resumeTxt = Content.Load<Texture2D>("Images\\playButton");
             restartTxt = Content.Load<Texture2D>("Images\\gui\\restartButton");
             pauseButtonTxt = Content.Load<Texture2D>("Images\\gui\\pauseButton");
             menuButtonTxt = Content.Load<Texture2D>("Images\\gui\\menuButton");
             restartButton = new BasicComponent(this.Game, restartTxt, restartRect, Color.White, 0.0f);
             resumeButton = new BasicComponent(this.Game, resumeTxt, resumeRect, Color.White, 0.0f);
             pauseScreen = new BasicComponent(this.Game, pauseScreenTxt, pauseScreenRect, Color.White, 0.0f);
             pauseButton = new BasicComponent(this.Game, pauseButtonTxt, pauseButtonRect, Color.White, 0.0f);
             menuButton = new BasicComponent(this.Game, menuButtonTxt, menuButtonRect, Color.White, 0.0f);

             restartButton.ItemDraw = false;
             pauseScreen.ItemDraw = false;
             resumeButton.ItemDraw = false;
             menuButton.ItemDraw = false;

             pauseButton.DrawOrder = 1012;
             pauseScreen.DrawOrder = 1000;
             menuButton.DrawOrder = 1013;
            resumeButton.DrawOrder = 1014;
            restartButton.DrawOrder = 1015;

             Components.Add(pauseButton);

             Components.Add(pauseScreen);
             Components.Add(restartButton);
             Components.Add(menuButton);
             Components.Add(resumeButton);
        }
コード例 #8
0
        //sikrer at man må dra leken rett oppi kurven
        protected void basketCollisionHandling(BasicComponent basket)
        {
            if (toy.CompRectX <= (basket.CompRectX + basket.ComponentRectangle.Width) && toy.CompRectX >= basket.CompRectX && toy.CompRectY + toy.ComponentRectangle.Height < basket.CompRectY)
            {
                onTopOfBasket = true;
                leftOfBasket = false;
                rightOfBasket = false;
            }
            else
            {

                onTopOfBasket = false;
            }

            if (toy.CompRectX > basket.CompRectX + basket.CompRectWidth)
            {
                rightOfBasket = true;
                leftOfBasket = false;
                onTopOfBasket = false;
            }
            else
            {

                if (toy.ItemMoving == false)
                    rightOfBasket = false;
            }

            if (toy.CompRectX + toy.CompRectWidth < basket.CompRectX)
            {
                leftOfBasket = true;
                onTopOfBasket = false;
            }
            else
            {
                if (toy.ItemMoving == false)
                    leftOfBasket = false;
            }

            if (toy.CompRectX - 10 <= (basket.CompRectX + basket.ComponentRectangle.Width) && (toy.CompRectY + toy.ComponentRectangle.Height) >= basketLeft.CompRectY && onTopOfBasket == false && leftOfBasket == false && rightOfBasket == true)
            {
                toy.CompRectX = basket.CompRectX + basket.ComponentRectangle.Width + 10;
            }

            if (leftOfBasket == true && rightOfBasket == false)
            {

                if (toy.CompRectX + toy.ComponentRectangle.Width >= (basketLeft.CompRectX - 10) && (toy.CompRectY + toy.ComponentRectangle.Height) >= basket.CompRectY && onTopOfBasket == false)
                {
                    toy.CompRectX = basket.CompRectX - (toy.ComponentRectangle.Width + 10);
                }

            }
            if (toy.ComponentRectangle.Intersects(basket.ComponentRectangle) && onTopOfBasket == false && leftOfBasket == false && rightOfBasket == false)
                toy.CompRectX = basket.CompRectX + 85;

            if (toy.CompRectX >= (basket.CompRectX) && (toy.CompRectY + toy.ComponentRectangle.Height) >= basket.CompRectY && onTopOfBasket == true)
            {
                toy.CompRectX = basket.CompRectX;
            }
        }
コード例 #9
0
        protected BasicComponent addFloorToy(int compNumber, int toyNumber, Color originalColor)
        {
            int x = rnd.Next(0, 650);
            int y = rnd.Next(290, 400);

            //string rot = // Convert.ToString(rnd.Next(0, 2)) + "." + Convert.ToString(rnd.Next(0, 9));

            double rotation = rnd.NextDouble();
            int nextFloorToy = rnd.Next(0, textures.Count - 1);

            rotationDirection = rotationDirection * -1f;
            rotation = rotation * rotationDirection;
            Rectangle tmpRect = new Rectangle(x, y, rectangles[compNumber].Width, rectangles[compNumber].Height);
            BasicComponent tmp = new BasicComponent(this.Game, textures[0], rectangles[0], Color.Wheat, 0f);

            tmp.DrawOrder = -100;
            tmp.ComponentType = "toy" + Convert.ToString(toyNumber);
            tmp.ComponentNumber = compNumber;
            floorToys.Add(tmp);
            if ((y + tmpRect.Height)-60 < (mannRect.Y + mannRect.Height))
            {
                tmp.DrawOrder = 99;
                floorToysB.Add(tmp);
                tmp.Dispose();
              //  return tmp;
                return floorToysB[floorToysB.Count-1];
            }
            else
            {
                if (basketLeft.CompRectY + basketLeft.CompRectHeight < (tmpRect.Height + y) - 60)
                {
                    tmp.DrawOrder = 205;
                    floorToysI.Add(tmp);

                }
                else
                {
                    tmp.DrawOrder = 195;
                    floorToysI.Add(tmp);

                }
                tmp.Dispose();
                return floorToysI[floorToysI.Count-1];
               // return tmp;
            }
        }
コード例 #10
0
        protected BasicComponent addFloorToy(int compNumber, int toyNumber)
        {
            int x = rnd.Next(0, 650);
            int y = rnd.Next(270, 420);

            //string rot = // Convert.ToString(rnd.Next(0, 2)) + "." + Convert.ToString(rnd.Next(0, 9));

            double rotation = rnd.NextDouble();
            int nextFloorToy = rnd.Next(0, textures.Count - 1);

            rotationDirection = rotationDirection * -1f;
            rotation = rotation * rotationDirection;
            Rectangle tmpRect = new Rectangle(x, y, rectangles[compNumber].Width, rectangles[compNumber].Height);

            GameTools.randomColor(ref floorToyColor, 255);
            tmpColor = floorToyColor;
            while (floorToyColor == tmpColor)
            {
                GameTools.randomColor(ref floorToyColor, 255);
            }
            GameTools.randomColor(ref tmpColor, 255);
            // rectangles.Add(rect);
            //textures.Add(text);
            BasicComponent tmp = new BasicComponent(this.Game, textures[compNumber], tmpRect, floorToyColor, (float)rotation);

            tmp.ComponentType = "toy" + Convert.ToString(toyNumber);
            tmp.ComponentNumber = compNumber;
            floorToys.Add(tmp);
            if ((y + tmpRect.Height)-60 < (mannRect.Y + mannRect.Height))
            {
                tmp.DrawOrder = 99;
                floorToysB.Add(tmp);
                tmp.Dispose();
                return floorToysB[floorToysB.Count - 1];

            }
            else
            {
                if (basketLeft.CompRectY + basketLeft.CompRectHeight < (tmpRect.Height + y)-60)
                {
                    tmp.DrawOrder = 205;
                    floorToysI.Add(tmp);

                }
                else
                {
                    tmp.DrawOrder = 195;
                    floorToysI.Add(tmp);

                }

                tmp.Dispose();
                return floorToysI[floorToysI.Count-1];
            }
        }
コード例 #11
0
        protected override void UnloadContent()
        {
            accelSensor = null;
            indicator = null;
            basketLeft = null;
            basketOpeningLeft = null;

            basketRight = null;
            mama = null;
            boy = null;
            toy = null;
            talkingBubble = null;
            gameStorage = null;
            toysBackground = null;
            toysForeground = null;
            toyName = null;
            gameStorage = null;
            spriteBatch = null;
            mannTexture = null;
            mannTexture2 = null;
            mannTexture3 = null;
            basketTxt = null;
            boyDissapointedTxt = null;
            roomTexture = null;
            crayonTxt = null;
            guiBubbleTxt = null;
            basketLeftTxt = null;
            basketOpeningTxt = null;
            loadScreen = null;
            pauseScreenTxt = null;
            indicatorTxt = null;

            resumeTxt = null;
            restartTxt = null;
            pauseButtonTxt = null;
            menuButtonTxt = null;
            mamaTxt = null;
            roomdooropen = null;
            mannRect = Rectangle.Empty;
            bskHit = Rectangle.Empty;
            basketLeftRect = Rectangle.Empty;
            mannRect2 = Rectangle.Empty;
            mannRect3 = Rectangle.Empty;
            defaultRect = Rectangle.Empty;
            roomRect = Rectangle.Empty;
            indicatorRct = Rectangle.Empty;
            crayonRect = Rectangle.Empty;
            guiBubbleRct = Rectangle.Empty;
            basketOpeningRct = Rectangle.Empty;
            basketRightRect = Rectangle.Empty;
            basketOpeningLRct = Rectangle.Empty;
            basketOpeningRRct = Rectangle.Empty;
            bskHitL = Rectangle.Empty;
            bskHitR = Rectangle.Empty;
            pauseScreenRect = Rectangle.Empty;
            restartRect = Rectangle.Empty;
            resumeRect = Rectangle.Empty;
            pauseButtonRect = Rectangle.Empty;
            menuButtonRect = Rectangle.Empty;
            mamaRct = Rectangle.Empty;
            mannRect4 = Rectangle.Empty;
            gameGUI = null;
            colorList = null;

            rnd = null;
            toy = null;
            spriteFont = null;
            boy = null;
            roomBackground = null;
            basketOpening = null;
            basketOpeningLeft = null;
            basketOpeningRight = null; basketRight = null;
            pauseScreen = null;
            resumeButton = null;
            restartButton = null;
            pauseButton = null;
            menuButton = null;
            indicator = null;
            mama = null;

            Components.Clear();
            for (int i = 0; i < rectangles.Length; i++)
            {
                rectangles[i] = Rectangle.Empty;
            }
            if (crayons != null)
            {
                for (int c = 0; c < crayons.Length; c++)
                {
                    crayons[c] = null;

                }
            }
            crayons = null;
            backgroundMusic = null;
            yeah = null;
            ohno = null;
            myBoy = null;
            toysCollected.Clear();
            toysCollected = null;
            yeahinst = null;
            ohnoinst = null;
            backgroundMusicInst = null;
            myBoyInst = null;
            graphics = null;
            vibration = null;
            gameMS = null;
            toysBackground = null;
            toysForeground = null;
            toyName = string.Empty;
            toyNamePrefix = string.Empty;
            musicStateStopped = string.Empty;
            for (int r = 0; r < rectangles.Length; r++)
                rectangles[r] = Rectangle.Empty;
            Content.Unload();
            while (Components.Count > 0)
                Components.RemoveAt(0);

            for (int txt = 0; txt < textures.Length; txt++)
            {
                textures[txt] = null;
            }

            textures = null;
            unLoadPauseScreen();

            base.UnloadContent();

            string test = GC.GetTotalMemory(true).ToString();
        }