Esempio n. 1
0
 void Load_0()
 {
     musicPlayer = sounds["beginningSong"].CreateInstance();
     if (playMusic)
     {
         musicPlayer.Play();
     }
     SceneStart = new TimeSpan();
     vanFrame   = SceneStart + FrameRate;
     road       = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/road_0") }, new Rectangle(0, 0, 1280, 720))
     {
         RenderOrder = 1
     };
     van = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/van_0"), Content.Load <Texture2D>("Graphics/van_1") }, new Rectangle(0, 0, 1280, 720))
     {
         RenderOrder = 2
     };
     spaceBar = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/space") }, new Rectangle(1079, 564, 165, 132))
     {
         RenderOrder = 3
     };
     components = new List <Component>()
     {
         van, road, spaceBar
     };
     components.Sort((x, y) => x.RenderOrder.CompareTo(y.RenderOrder));
 }
Esempio n. 2
0
 void Load_2()
 {
     vanFrame = SceneStart + FrameRate;
     road     = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/road_0"), Content.Load <Texture2D>("Graphics/road_1"), Content.Load <Texture2D>("Graphics/road_2"), Content.Load <Texture2D>("Graphics/road_3"), Content.Load <Texture2D>("Graphics/road_4"), }, new Rectangle(0, 0, 1280, 720))
     {
         RenderOrder = 1
     };
     van = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/van_0"), Content.Load <Texture2D>("Graphics/van_2"), Content.Load <Texture2D>("Graphics/van_3"), Content.Load <Texture2D>("Graphics/van_4") }, new Rectangle(0, 0, 1280, 720))
     {
         RenderOrder = 2
     };
     spaceBar = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/space") }, new Rectangle(1079, 564, 165, 132))
     {
         RenderOrder = 3
     };
     components = new List <Component>()
     {
         van, road, spaceBar
     };
     components.Sort((x, y) => x.RenderOrder.CompareTo(y.RenderOrder));
 }
Esempio n. 3
0
 public Interaction(Dragable dragable, BGGraphic bGGraphic)
 {
     _dragable = dragable;
     _graphic  = bGGraphic;
 }
Esempio n. 4
0
        void Load_3()
        {
            doorOpened  = false;
            doorOpening = false;
            LevelFinish = false;
            gameState   = 0;
            putCount    = 0;
            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(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].X + ObjectMovingRestrictionList[0].Width), rd.Next(ObjectMovingRestrictionList[0].Y, ObjectMovingRestrictionList[0].Y + ObjectMovingRestrictionList[0].Height), 171, 216))
                {
                    RenderOrder = 4,
                    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(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].X + ObjectMovingRestrictionList[0].Width), rd.Next(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].Y + ObjectMovingRestrictionList[0].Height), 180, 184))
                {
                    RenderOrder = 4,
                    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(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].X + ObjectMovingRestrictionList[0].Width), rd.Next(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].Y + ObjectMovingRestrictionList[0].Height), 200, 200))
                {
                    RenderOrder = 4,
                    ID          = 2,

                    holdPoint = new Point(49, 61)
                },
            };

            /*
             * taskList = new TaskList(Content.Load<Texture2D>("Graphics/TaskList"), new Rectangle(29, 20, 147, 200), Content.Load<SpriteFont>("Font/font"))
             * {
             *  RenderOrder = 5,
             *  taskList = new List<Task>()
             * };
             * foreach (Dragable animal in animals)
             * {
             *  taskList.taskList.Add(new Task("Hide " + animal.name, animal.ID));
             * }
             * taskList.taskList.Add(new Task("Turn off the\n         light", animals.Count));
             */

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

            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))
                {
                    ID = 20
                },
                new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/curtain_0"), Content.Load <Texture2D>("Graphics/curtain_1") }, new Rectangle(567, 58, 175, 258))
                {
                    ID = 21
                }
            };
            spaceBar = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/space") }, new Rectangle(1079, 564, 165, 132))
            {
                RenderOrder = 4,
                isVisible   = false,
                suprisee    = true
            };
            lightSwitch = new Button(Content.Load <Texture2D>("Graphics/switch_1"), Content.Load <Texture2D>("Graphics/switch_0"))
            {
                RenderOrder = 3,
                Position    = new Vector2(1000, 180)
            };
            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
            };
            confetti = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/confetti") }, new Rectangle(0, 0, ScreenWidth, ScreenHeight))
            {
                RenderOrder = 100,
                isVisible   = false
            };
            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
            };

            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 = 3
            };
            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 = 3
            };
            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 = 3
            };

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

            foreach (var item in animals)
            {
                for (int i = 0; i < horns.Length; i++)
                {
                    item.objInBodies.Add(horns[i]);
                }
            }

            components = new List <Component>()
            {
                room,
                spaceBar,
                lightSwitch,
                door,
                confetti,
                cat,
                horns[0],
                horns[1],
                horns[2],
                lounge,
                rug2,
                sofa2
            };
            interactableObjs2 = new List <InteractableObj>();
            interactableObjs2.Add(lounge);
            interactableObjs2.Add(rug2);
            interactableObjs2.Add(sofa2);

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

            cat.MoveTo(new Point(170, 142 - 219));
            SceneStart = _gameTime.TotalGameTime;
        }
Esempio n. 5
0
        void Load_1()
        {
            #region Scene1_LoadContent

            sounds["comeOn"].Play();
            // UIs
            #region Initialize parameters
            // dragable animals
            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(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].X + ObjectMovingRestrictionList[0].Width), rd.Next(ObjectMovingRestrictionList[0].Y, ObjectMovingRestrictionList[0].Y + ObjectMovingRestrictionList[0].Height), 171, 216))
                {
                    RenderOrder = 4,
                    ID          = 0
                },
                new Dragable(new Texture2D[] { Content.Load <Texture2D>("Graphics/hamster_0"), Content.Load <Texture2D>("Graphics/hamster_1") },
                             new Rectangle(rd.Next(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].X + ObjectMovingRestrictionList[0].Width), rd.Next(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].Y + ObjectMovingRestrictionList[0].Height), 103, 127))
                {
                    RenderOrder = 4,
                    ID          = 1
                },
                new Dragable(new Texture2D[] { Content.Load <Texture2D>("Graphics/Bear_0"), Content.Load <Texture2D>("Graphics/Bear_1") },
                             new Rectangle(rd.Next(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].X + ObjectMovingRestrictionList[0].Width), rd.Next(ObjectMovingRestrictionList[0].X, ObjectMovingRestrictionList[0].Y + ObjectMovingRestrictionList[0].Height), 100, 100))
                {
                    RenderOrder = 4,
                    ID          = 2
                },
            };

            /*
             * taskList = new TaskList(Content.Load<Texture2D>("Graphics/TaskList"), new Rectangle(29, 20, 147, 200), Content.Load<SpriteFont>("Font/font"))
             * {
             *  RenderOrder = 5,
             *  taskList = new List<Task>()
             * };
             * foreach (Dragable animal in animals)
             * {
             *  taskList.taskList.Add(new Task("Hide " + animal.name, animal.ID));
             * }
             * taskList.taskList.Add(new Task("Turn off the\n         light", animals.Count));
             */
            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
            };
            confetti = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/confetti") }, new Rectangle(0, 0, ScreenWidth, ScreenHeight))
            {
                RenderOrder = 100,
                isVisible   = false
            };
            balloons = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/ballons") }, new Rectangle(480, 100, 143, 230))
            {
                RenderOrder = 1
            };
            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
            };
            cat.isVisible = true;

            var room = new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/room") }, new Rectangle(0, 0, 1280, 720))
            {
                RenderOrder = 0
            };
            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 = 3
            };

            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 = 3
            };

            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 = 3,
            };
            lightSwitch = new Button(Content.Load <Texture2D>("Graphics/switch_1"), Content.Load <Texture2D>("Graphics/switch_0"))
            {
                RenderOrder = 3,
                Position    = new Vector2(1000, 180)
            };

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

            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))
                {
                    ID = 20
                },
                new BGGraphic(new Texture2D[] { Content.Load <Texture2D>("Graphics/curtain_0"), Content.Load <Texture2D>("Graphics/curtain_1") }, new Rectangle(567, 58, 175, 258))
                {
                    ID = 21
                }
            };

            foreach (var item in curtains)
            {
                item.OnPress += OnPressCurtain;
            }
            #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);
            }


            // 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

            cat.MoveTo(new Point(170, 142 - 219));

            #endregion
        }