示例#1
0
        void Load_3()
        {
            gameState = 0;
            putCount  = 0;
            swapper   = true;

            door = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/door_0"), Content.Load <Texture2D>("Graphics/door_1") }, new Rectangle(811, 130, 143, 230))
            {
                RenderOrder = 0
            };

            cat = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/cat_0"), Content.Load <Texture2D>("Graphics/cat_1"), Content.Load <Texture2D>("Graphics/cat_2"), Content.Load <Texture2D>("Graphics/cat_3") }, new Rectangle(0, 265, 152, 180))
            {
                RenderOrder  = 1,
                DisplayingID = 3,
                suprisee     = true,
                MoveSpeed    = 2
            };

            var room = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/room2") }, new Rectangle(0, 0, 1280, 720))
            {
                RenderOrder = 2
            };

            curtains = new List <BGGraphic>
            {
                new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/curtain_0"), Content.Load <Texture2D>("Graphics/curtain_1") }, new Rectangle(265, 58, 175, 258))
                {
                    RenderOrder = 3, ID = 20
                },
                new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/curtain_0"), Content.Load <Texture2D>("Graphics/curtain_1") }, new Rectangle(567, 58, 175, 258))
                {
                    RenderOrder = 3, ID = 21
                }
            };

            lounge = new InteractableObj(new Texture2D[] { Content.Load <Texture2D>("Graphics/Lounge_0"), Content.Load <Texture2D>("Graphics/Lounge_1"), Content.Load <Texture2D>("Graphics/Lounge_2") }, new Rectangle(325, 251, 398, 219), new Point(467, 354), animals)
            {
                ID          = 0,
                RenderOrder = 4
            };
            var rug2 = new InteractableObj(new Texture2D[] { Content.Load <Texture2D>("Graphics/rug_0"), Content.Load <Texture2D>("Graphics/rug_1"), Content.Load <Texture2D>("Graphics/rug_2") }, new Rectangle(521, 452, 366, 366), new Point(615, 665), animals)
            {
                ID          = 1,
                RenderOrder = 4
            };
            var sofa2 = new InteractableObj(new Texture2D[] { Content.Load <Texture2D>("Graphics/sofa_0"), Content.Load <Texture2D>("Graphics/sofa_1"), Content.Load <Texture2D>("Graphics/sofa_2") }, new Rectangle(100, 360, 352, 352), new Point(258, 548), animals)
            {
                ID          = 2,
                RenderOrder = 4
            };

            lightSwitch = new Button(Content.Load <Texture2D>("Graphics/switch_1"), Content.Load <Texture2D>("Graphics/switch_0"))
            {
                RenderOrder = 4,
                Position    = new Vector2(1000, 180)
            };


            animals = new List <Dragable>
            {
                new Dragable(new Texture2D[] { Content.Load <Texture2D>("Graphics/owl_grey_0"), Content.Load <Texture2D>("Graphics/owl_grey_1") },
                             new Rectangle(rd.Next(ObjectSpace.X, ObjectSpace.X + ObjectSpace.Width), rd.Next(ObjectSpace.Y, ObjectSpace.Y + ObjectSpace.Height), 171, 216))
                {
                    RenderOrder = 5,
                    ID          = 0,
                    holdPoint   = new Point(98, 65)
                },
                new Dragable(new Texture2D[] { Content.Load <Texture2D>("Graphics/Fox_Peach_0"), Content.Load <Texture2D>("Graphics/Fox_Peach_1") },
                             new Rectangle(rd.Next(ObjectSpace.X, ObjectSpace.X + ObjectSpace.Width), rd.Next(ObjectSpace.X, ObjectSpace.Y + ObjectSpace.Height), 180, 184))
                {
                    RenderOrder = 5,
                    ID          = 1,
                    holdPoint   = new Point(58, 92)
                },
                new Dragable(new Texture2D[] { Content.Load <Texture2D>("Graphics/Bear_0"), Content.Load <Texture2D>("Graphics/Bear_1") },
                             new Rectangle(rd.Next(ObjectSpace.X, ObjectSpace.X + ObjectSpace.Width), rd.Next(ObjectSpace.X, ObjectSpace.Y + ObjectSpace.Height), 200, 200))
                {
                    RenderOrder = 5,
                    ID          = 2,
                    holdPoint   = new Point(49, 61)
                }
            };

            horns = new List <ObjInBody> {
                new ObjInBody(Content.Load <Texture2D>("Graphics/Horn_0"), new Rectangle(100, 600, 50, 50))
                {
                    RenderOrder = 6,
                    isVisible   = true
                }, new ObjInBody(Content.Load <Texture2D>("Graphics/Horn_1"), new Rectangle(200, 400, 50, 50))
                {
                    RenderOrder = 6,
                    isVisible   = true
                },
                new ObjInBody(Content.Load <Texture2D>("Graphics/Horn_2"), new Rectangle(400, 500, 50, 50))
                {
                    RenderOrder = 6,
                    isVisible   = true
                }
            };

            spaceBar = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/space") }, new Rectangle(1079, 564, 165, 132))
            {
                RenderOrder = 7,
                isVisible   = false,
                suprisee    = true
            };

            confetti = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/confetti") }, new Rectangle(0, 0, ScreenWidth, ScreenHeight))
            {
                RenderOrder = 8,
                isVisible   = false
            };


            components = new List <Component>()
            {
                room,
                spaceBar,
                lightSwitch,
                door,
                confetti,
                cat,
                lounge,
                rug2,
                sofa2
            };

            foreach (Dragable animal in animals)
            {
                components.Add(animal);
                for (int i = 0; i < horns.Count; i++)
                {
                    animal.objInBodies.Add(horns[i]);
                }
            }


            foreach (BGGraphic curt in curtains)
            {
                components.Add(curt);
            }
            foreach (ObjInBody horn in horns)
            {
                components.Add(horn);
            }

            interactObjs = new List <InteractableObj>()
            {
                lounge, rug2, sofa2
            };

            components.Sort((x, y) => x.RenderOrder.CompareTo(y.RenderOrder));
        }
示例#2
0
        void Load_1()
        {
            #region Scene1_LoadContent

            // UIs
            #region Initialize parameters
            gameState = 0;
            putCount  = 0;
            swapper   = true;
            // dragable animals
            door = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/door_0"), Content.Load <Texture2D>("Graphics/door_1") }, new Rectangle(811, 130, 143, 230))
            {
                RenderOrder = 0
            };

            cat = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/cat_0"), Content.Load <Texture2D>("Graphics/cat_1"), Content.Load <Texture2D>("Graphics/cat_2"), Content.Load <Texture2D>("Graphics/cat_3") }, new Rectangle(0, 265, 152, 180))
            {
                RenderOrder  = 1,
                DisplayingID = 3,
                suprisee     = true,
                MoveSpeed    = 2
            };

            BGGraphic room = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/room") }, new Rectangle(0, 0, 1280, 720))
            {
                RenderOrder = 2
            };

            curtains = new List <BGGraphic>()
            {
                new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/curtain_0"), Content.Load <Texture2D>("Graphics/curtain_1") }, new Rectangle(265, 58, 175, 258))
                {
                    RenderOrder = 3, ID = 20
                },
                new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/curtain_0"), Content.Load <Texture2D>("Graphics/curtain_1") }, new Rectangle(567, 58, 175, 258))
                {
                    RenderOrder = 3, ID = 21
                }
            };

            balloons = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/ballons") }, new Rectangle(480, 100, 143, 230))
            {
                RenderOrder = 4
            };

            boxes = new InteractableObj(new Texture2D[] { Content.Load <Texture2D>("Graphics/box_0"), Content.Load <Texture2D>("Graphics/box_1"), Content.Load <Texture2D>("Graphics/box_2") }, new Rectangle(780, 339, 300, 300), new Point(780 + 150 - 20, 339 + 150), animals)
            {
                ID          = 0,
                RenderOrder = 5
            };
            sofa = new InteractableObj(new Texture2D[] { Content.Load <Texture2D>("Graphics/sofa_0"), Content.Load <Texture2D>("Graphics/sofa_1"), Content.Load <Texture2D>("Graphics/sofa_2") }, new Rectangle(420, 189, 300, 300), new Point(420 + 184, 189 + 226), animals)
            {
                ID          = 1,
                RenderOrder = 5
            };
            rug = new InteractableObj(new Texture2D[] { Content.Load <Texture2D>("Graphics/rug_0"), Content.Load <Texture2D>("Graphics/rug_1"), Content.Load <Texture2D>("Graphics/rug_2") }, new Rectangle(320, 389, 300, 300), new Point(126 + 320, 389 + 220), animals)
            {
                ID          = 2,
                RenderOrder = 5
            };
            lightSwitch = new Button(Content.Load <Texture2D>("Graphics/switch_1"), Content.Load <Texture2D>("Graphics/switch_0"))
            {
                RenderOrder = 5,
                Position    = new Vector2(1000, 180)
            };

            animals = new List <Dragable>
            {
                new Dragable(new Texture2D[] { Content.Load <Texture2D>("Graphics/owl_grey_0"), Content.Load <Texture2D>("Graphics/owl_grey_1") },
                             new Rectangle(rd.Next(ObjectSpace.X, ObjectSpace.X + ObjectSpace.Width), rd.Next(ObjectSpace.Y, ObjectSpace.Y + ObjectSpace.Height), 171, 216))
                {
                    RenderOrder = 6,
                    ID          = 0
                },
                new Dragable(new Texture2D[] { Content.Load <Texture2D>("Graphics/hamster_0"), Content.Load <Texture2D>("Graphics/hamster_1") },
                             new Rectangle(rd.Next(ObjectSpace.X, ObjectSpace.X + ObjectSpace.Width), rd.Next(ObjectSpace.X, ObjectSpace.Y + ObjectSpace.Height), 103, 127))
                {
                    RenderOrder = 6,
                    ID          = 1
                },
                new Dragable(new Texture2D[] { Content.Load <Texture2D>("Graphics/Bear_0"), Content.Load <Texture2D>("Graphics/Bear_1") },
                             new Rectangle(rd.Next(ObjectSpace.X, ObjectSpace.X + ObjectSpace.Width), rd.Next(ObjectSpace.X, ObjectSpace.Y + ObjectSpace.Height), 100, 100))
                {
                    RenderOrder = 6,
                    ID          = 2
                },
            };

            spaceBar = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/space") }, new Rectangle(1079, 564, 165, 132))
            {
                RenderOrder = 7,
                isVisible   = false,
                suprisee    = true
            };

            confetti = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/confetti") }, new Rectangle(0, 0, ScreenWidth, ScreenHeight))
            {
                RenderOrder = 8,
                isVisible   = false
            };
            #endregion

            components = new List <Component>()
            {
                door,
                balloons,
                cat,
                room,
                boxes,
                sofa,
                rug,
                lightSwitch,
                spaceBar,
                confetti,
                curtains[0],
                curtains[1]
            };

            foreach (Dragable animal in animals)
            {
                components.Add(animal);
            }

            foreach (BGGraphic curt in curtains)
            {
                components.Add(curt);
            }


            // sort the list by the render order
            components.Sort((x, y) => x.RenderOrder.CompareTo(y.RenderOrder));

            #region interaction list and method

            interactObjs = new List <InteractableObj>()
            {
                boxes,
                sofa,
                rug
            };
            #endregion

            #endregion
        }