Example #1
0
        public override void Update()
        {
            base.Update();

            pControl = pControl == null ? new XboxController(SlimDX.XInput.UserIndex.Two) : pControl;

            if (!GameOver && (ObjectManager.GetAllObjectsByName("CANNON").Count == 0 ||
                ObjectManager.GetObjectByName("PLAYER") == null))
            {
                TextManager.AddText("RESTART", "Press START to restart", FontTypes.Arial32);
                TextObject text = TextManager.GetTextObjectByName("RESTART");
                text.Position.X = -Game.WindowWidth / 2;
                text.Position.Y = Game.WindowHeight / 2;
                GameOver = true;
            }

            if (GameOver)
            {
                pControl.Update();
                if (cControl.IsTriggered(XboxKeys.START) || pControl.IsTriggered(XboxKeys.START))
                    GameStateManager.GoToState(new Level());
            }
        }