예제 #1
0
 private void OpenDoor(GameTime gameTime)
 {
     door.SetIMG(1);
     IntervalSpan2 = SceneStart;
 }
예제 #2
0
        void Update_1(GameTime gameTime)
        {
            #region Update_Scene1
            mousePosition = new Vector2(currentMouseState.X, currentMouseState.Y);
            foreach (Component item in components)
            {
                item.Update(gameTime);
            }

            // mouse staffs
            previousMouseState = currentMouseState;
            currentMouseState  = Mouse.GetState();


            if (gameState == 0)
            {
                UpdateMouse();
                if (gameTime.TotalGameTime < SceneStart + FirstLeg && swapper)
                {
                    sounds["comeOn"].Play();
                    cat.MoveTo(new Point(170, 142 - 219));
                    swapper = false;
                }
                else if (gameTime.TotalGameTime > SceneStart + FirstLeg && !swapper)
                {
                    cat.MoveTo(new Point(800 - 170, 0));
                    sounds["goGoGo"].Play();
                    swapper = true;
                }
                else if (gameTime.TotalGameTime > SceneStart + FirstLeg + SecondLeg && swapper)
                {
                    cat.SetIMG(0);
                    sounds["shush"].Play();
                    OpenDoor(gameTime);
                    swapper   = false;
                    gameState = 1;
                }
            }

            if (gameState == 1)
            {
                if (gameTime.TotalGameTime > SceneStart + FirstLeg + SecondLeg + DoorOpenToComeIn && !swapper)
                {
                    spaceBar.isVisible = true;
                    foreach (Dragable animal in animals)
                    {
                        animal.StopMovement();
                    }
                    swapper = true;
                }
                else if (Keyboard.GetState().IsKeyDown(Keys.Space) && swapper)
                {
                    gameState      = 2;
                    Game1.supriser = Color.White;
                    Game1.suprisee = Color.White;
                    CheckResult_Scene1();
                    foreach (Dragable animal in animals)
                    {
                        if (animal.InSpot)
                        {
                            animal.DisplayingID = 1;
                        }
                        animal.isVisible = true;
                    }
                    foreach (var item in interactObjs)
                    {
                        item.SetIMG(0);
                    }
                }
            }

            if (gameState == 2)
            {
                if (Keyboard.GetState().IsKeyDown(Keys.N))
                {
                    GameScene = 2;
                    Load_2();
                }
            }
            #endregion
        }