示例#1
0
        public void ReplayGame()
        {
            Game.GetPhysics().Dispose();

            InfoBody foeBody = Game.GetPhysics().AddCircle(Game.GetWindowWidth() / 2, 100, 50, 0, 1f, 1f, 1f, GameResource.circle_3, "I");

            myBody   = Game.GetPhysics().AddCircle(Game.GetWindowWidth() / 2, Game.GetWindowHeight() - 100, 50, 0, 1f, 1f, 1f, GameResource.circle_1, "FOE");
            ballBody = Game.GetPhysics().AddCircle(Game.GetWindowWidth() / 2, Game.GetWindowHeight() / 2 + 40, 30, 0, 1f, 1f, 1f, GameResource.circle_2, "BALL");
            LFoe     = new LogicFoe(Game, foeBody, ballBody);

            // Create borders
            Game.GetPhysics().AddRect(0, Game.GetWindowHeight() / 2, 20, Game.GetWindowHeight(), 0, 0f, 0f, 0f, GameResource.rect_3, "BORDER");
            Game.GetPhysics().AddRect(Game.GetWindowWidth() - 15, Game.GetWindowHeight() / 2, 20, Game.GetWindowHeight(), 0, 0f, 0f, 0f, GameResource.rect_3, "BORDER");

            Game.GetSystemParticles().Dispose();
        }
示例#2
0
        public override void Resume()
        {
            // Initialize particle parameters
            partParams    = new GSystemParticles.ParticleParameters[1];
            partParams[0] = new GSystemParticles.ParticleParameters()
            {
                Type   = GSystemParticles.TypeParticle.Circle,
                Color  = Color.DarkTurquoise,
                TTL    = 100,
                radius = 10
            };

            // Initialize Physics
            Game.GetPhysics().Initialize(-1000, -1000, 1000, 1000, 0, 0, false);
            Game.GetPhysics().GetSolver().onAdd += ScreenGame_onAdd;

            // Create circles
            InfoBody foeBody = Game.GetPhysics().AddCircle(Game.GetWindowWidth() / 2, 100, 50, 0, 1f, 1f, 1f, GameResource.circle_3, "I");

            myBody   = Game.GetPhysics().AddCircle(Game.GetWindowWidth() / 2, Game.GetWindowHeight() - 100, 50, 0, 1f, 1f, 1f, GameResource.circle_1, "FOE");
            ballBody = Game.GetPhysics().AddCircle(Game.GetWindowWidth() / 2, Game.GetWindowHeight() / 2 + 40, 30, 0, 1f, 1f, 1f, GameResource.circle_2, "BALL");
            LFoe     = new LogicFoe(Game, foeBody, ballBody);

            // Create borders
            Game.GetPhysics().AddRect(0, Game.GetWindowHeight() / 2, 20, Game.GetWindowHeight(), 0, 0f, 0f, 0f, GameResource.rect_3, "BORDER");
            Game.GetPhysics().AddRect(Game.GetWindowWidth() - 15, Game.GetWindowHeight() / 2, 20, Game.GetWindowHeight(), 0, 0f, 0f, 0f, GameResource.rect_3, "BORDER");

            // Decor
            image_line = new GImage(Game);
            image_line.SetImage(GameResource.rect_1);
            image_line.SetX(Game.GetWindowWidth() / 2);
            image_line.SetY(Game.GetWindowHeight() / 2);
            image_line.SetWidth(Game.GetWindowWidth());
            image_line.SetHeight(10);

            // Create intent to menu
            Intent intent_to_menu = new Intent(Game);

            intent_to_menu.SetScreenLoading(null);

            // Create top panel
            topPanel = new GTopPanel(Game);
            topPanel.ClearBalls();
            topPanel.onCommand += (cmd) =>
            {
                switch (cmd)
                {
                case GTopPanel.CommandTopPanel.menu:
                    intent_to_menu.screenFrom = this;
                    intent_to_menu.screenTo   = new ScreenMenu(Game);
                    intent_to_menu.Start();
                    break;

                case GTopPanel.CommandTopPanel.play:
                    IsPause = false;
                    break;

                case GTopPanel.CommandTopPanel.pause:
                    IsPause = true;
                    break;
                }
            };
            AddElement(topPanel);
        }