Пример #1
0
        public void Update()
        {
            if (firstRun)
            {
                onFirstRun();
            }

            if (Network.connected)
            {
                Network.Update();

                foreach (Player player in players.Values)
                {
                    // Update player positions
                    player.Update();
                }

                spawner.Update();
            }
            else
            {
                ScreenManager.gameState = GameState.MainMenu;
                firstRun = true;
            }

            KeyboardInput.HandleEscToMenu();
            ScreenManager.cursorState = CursorState.Crosshair;
        }
Пример #2
0
        public void Update()
        {
            bool anyMouseOver = false;

            foreach (Button button in menuButtons)
            {
                button.Update(ScreenManager.mouse);
                if (button.isMouseOver)
                {
                    anyMouseOver = true;
                }
                if (button.isClicked)
                {
                    // Decided what to do based on the button clicked
                    switch (button.name)
                    {
                    case "Back": ScreenManager.gameState = GameState.MainMenu; break;
                    }
                }
            }

            // Change the cursor if it's hovering over a button
            if (anyMouseOver)
            {
                ScreenManager.cursorState = CursorState.Hand;
            }
            else
            {
                ScreenManager.cursorState = CursorState.Pointer;
            }

            KeyboardInput.HandleEscToMenu();
        }
Пример #3
0
        private void HandleInput()
        {
            KeyboardInput.HandleMovementInput(this);

            if (m_up)
            {
                velocity -= Vector2.UnitY / 5;
                m_up      = false;
            }

            if (m_down)
            {
                velocity += Vector2.UnitY / 5;
                m_down    = false;
            }

            if (m_left)
            {
                velocity -= Vector2.UnitX / 5;
                m_left    = false;
            }

            if (m_right)
            {
                velocity += Vector2.UnitX / 5;
                m_right   = false;
            }

            if (m_shoot)
            {
                shoot();
                m_shoot = false;
            }
        }
Пример #4
0
        public void Update()
        {
            bool anyMouseOver = false;

            foreach (Button button in menuButtons)
            {
                button.Update(ScreenManager.mouse);
                if (button.isMouseOver)
                {
                    anyMouseOver = true;
                }
                if (button.isClicked)
                {
                    switch (button.name)
                    {
                    case "Username":
                    case "Resolution":
                    case "Show Debug":
                    case "Show Bounds":
                    case "Show Depths":
                    {
                        if (!editorOpen)
                        {
                            editorOpen = true;
                            editor     = Process.Start("notepad.exe", "MoboSettings.xml");
                        }
                        break;
                    }

                    case "Difficulty":
                    {
                        SettingsManager.toggleDifficulty();
                        break;
                    }

                    case "Back": ScreenManager.gameState = GameState.MainMenu; break;
                    }
                }
            }

            if (anyMouseOver)
            {
                ScreenManager.cursorState = CursorState.Hand;
            }
            else
            {
                ScreenManager.cursorState = CursorState.Pointer;
            }

            if (editor != null && editor.HasExited)
            {
                editorOpen = false;
                SettingsManager.Load();
            }

            KeyboardInput.HandleEscToMenu();
        }
Пример #5
0
        public void Update()
        {
            bool anyMouseOver = false;

            foreach (Button button in menuButtons)
            {
                button.Update(ScreenManager.mouse);
                if (button.isMouseOver)
                {
                    anyMouseOver = true;
                }
                if (button.isClicked)
                {
                    switch (button.name)
                    {
                    case "Back": ScreenManager.gameState = GameState.MainMenu; break;

                    case "Generate!": Generate(); break;

                    case "+size": size++; break;

                    case "-size": size--; break;

                    case "+diff": difficulty++; break;

                    case "-diff": difficulty--; break;

                    case "+branch": branches++; break;

                    case "-branch": branches--; break;

                    case "debug": SettingsManager.toggleDepths(); break;
                    }
                }
            }

            if (anyMouseOver)
            {
                ScreenManager.cursorState = CursorState.Hand;
            }
            else
            {
                ScreenManager.cursorState = CursorState.Pointer;
            }

            if (station != null)
            {
                station.Update();
            }

            KeyboardInput.HandleEscToMenu();
        }
Пример #6
0
        public void Update()
        {
            // Update player position
            foreach (Player player in players.Values)
            {
                // Update player positions
                player.Update();
            }

            spawner.Update();

            KeyboardInput.HandleEscToMenu();
            ScreenManager.cursorState = CursorState.Crosshair;
        }