예제 #1
0
파일: Game1.cs 프로젝트: danbolt/hacklandia
        private void UpdateLobby(GameTime gameTime)
        {
            Lobby.User.X = (int)(((ein.UserX / .5f) * GameConstants.MiniGameCanvasWidth) + GameConstants.MiniGameCanvasWidth);
            Lobby.User.Y = (int)(((ein.UserZ - 0.9f) * GameConstants.MiniGameCanvasHeight));


            if (Rectangle.Intersect(Lobby.User, Lobby.Landing).Height > 0)
            {
                Lobby.landingHoverTimer += gameTime.ElapsedGameTime.Milliseconds;

                if (Lobby.landingHoverTimer > Lobby.landingHoverDuration)
                {
                    Lobby.READY = true;
                }
            }
            else
            {
                Lobby.landingHoverTimer = 0;
            }


            if (Lobby.READY)
            {
                miniGames        = new List <MiniGameContext>();
                addMiniGameTimer = 0;
                gameState        = MetaGameState.Running;
                ein.LastColor    = null;
                score            = 0;
            }
        }
예제 #2
0
파일: Game1.cs 프로젝트: danbolt/hacklandia
        private void UpdateRunning(GameTime gameTime)
        {
            addMiniGameTimer += gameTime.ElapsedGameTime.Milliseconds;
            if (miniGames.Count == 0 && addMiniGameTimer > 0)
            {
                g1.game   = PureRandomMiniGame();
                g1.canvas = new RenderTarget2D(GraphicsDevice, GameConstants.MiniGameCanvasWidth, GameConstants.MiniGameCanvasHeight);

                miniGames.Add(g1);
            }
            else if (miniGames.Count == 1 && addMiniGameTimer > addSecondMiniGameDuration && Lobby.Difficulty > 1)
            {
                g2.game   = PureRandomMiniGame();
                g2.canvas = new RenderTarget2D(GraphicsDevice, GameConstants.MiniGameCanvasWidth, GameConstants.MiniGameCanvasHeight);

                miniGames.Add(g2);
            }
            else if (miniGames.Count == 2 && addMiniGameTimer > addThirdMiniGameDuration && Lobby.Difficulty > 2)
            {
                g3.game   = PureRandomMiniGame();
                g3.canvas = new RenderTarget2D(GraphicsDevice, GameConstants.MiniGameCanvasWidth, GameConstants.MiniGameCanvasHeight);

                miniGames.Add(g3);
            }

            for (int i = 0; i < miniGames.Count; i++)
            {
                miniGames[i].game.Update(gameTime);
            }

            foreach (MiniGameContext me in miniGames)
            {
                if (me.game.GetState() == MiniGameState.Win)
                {
                    score += 100;

                    if (TypeOfGame(me.game) == 5)
                    {
                        ein.LastColor = null;
                    }

                    me.game = PureRandomMiniGame();
                }
                else if (me.game.GetState() == MiniGameState.Lose)
                {
                    gameState = MetaGameState.PlayerLose;
                }
            }
        }
예제 #3
0
파일: Game1.cs 프로젝트: danbolt/hacklandia
        private void UpdateLose(GameTime gameTime)
        {
            Lobby.LosePointer.X = (int)(((ein.UserX / .5f) * GameConstants.MiniGameCanvasWidth) + GameConstants.MiniGameCanvasWidth);
            Lobby.LosePointer.Y = (int)(((ein.UserZ - 0.9f) * GameConstants.MiniGameCanvasHeight));

            if (Rectangle.Intersect(Lobby.LosePointer, Lobby.LoseLanding).Height > 0)
            {
                gameState = MetaGameState.Init;

                foreach (MiniGameContext me in miniGames)
                {
                    me.game = null;
                }

                miniGames.Clear();
                Lobby.READY             = false;
                Lobby.Difficulty        = 0;
                Lobby.landingHoverTimer = 0;
                score = 0;
            }
        }
예제 #4
0
파일: Game1.cs 프로젝트: danbolt/hacklandia
        private void UpdateInit(GameTime gameTime)
        {
            Lobby.Pointer.X = (int)(ein.RightHand.Pos.X * GameConstants.MiniGameCanvasWidth);
            Lobby.Pointer.Y = (int)(ein.RightHand.Pos.Y * GameConstants.MiniGameCanvasHeight);

            bool thing  = ein.RightHand.Gripped;
            bool thing2 = ein.RightHand.Released;

            if (thing)
            {
                lobbyHandClosed = true;
            }

            if (thing2)
            {
                lobbyHandClosed = false;
            }

            if (Rectangle.Intersect(Lobby.Box1, Lobby.Pointer).Height > 0 && (!Lobby.prevFrameGrabbing && lobbyHandClosed))
            {
                Lobby.Difficulty = 1;
            }
            else if (Rectangle.Intersect(Lobby.Box2, Lobby.Pointer).Height > 0 && (!Lobby.prevFrameGrabbing && lobbyHandClosed))
            {
                Lobby.Difficulty = 2;
            }
            else if (Rectangle.Intersect(Lobby.Box3, Lobby.Pointer).Height > 0 && (!Lobby.prevFrameGrabbing && lobbyHandClosed))
            {
                Lobby.Difficulty = 3;
            }

            if (Lobby.Difficulty != 0)
            {
                gameState = MetaGameState.Lobby;
            }

            Console.WriteLine(lobbyHandClosed);

            Lobby.prevFrameGrabbing = lobbyHandClosed;
        }