Inheritance: Group
Beispiel #1
0
        public PauseGroup(Card card, Action unPauseCallback)
            : base()
        {
            z = HUD.HUGE_Z + 1;

              this.unPauseCallback = unPauseCallback;

              pauseOverlay = new PauseOverlay();
              add(pauseOverlay);

              this.card = card;
              add(card);

              controls = new Sprite(190, 148);
              controls.loadGraphic("controls", 251, 125);
              controls.visible = false;
              controls.screenPositioning = ScreenPositioning.Absolute;
              add(controls);

              pauseMenu = new Menu(195, 148);
              pauseMenu.addMenuText(new MenuText("RESUME", UnPause));
              pauseMenu.addMenuText(new MenuText("CONTROLS", displayControls));
              pauseMenu.addMenuText(new MenuText("RESTART", restart));
              pauseMenu.addMenuText(new MenuText("QUIT", quit));
              pauseMenu.deactivate();
              add(pauseMenu);

              restartMenu = new Menu(195, 148);
              restartMenu.addMenuText(new MenuText("YES", () => {
            //Assets.getSound("superKO").Play();
            Assets.getSound("startButton").Play();
            restartMenu.deactivate();
            card.Close();
              }));
              restartMenu.addMenuText(new MenuText("NO", goBack));
              restartMenu.deactivate();
              add(restartMenu);
        }
Beispiel #2
0
        public override void Create()
        {
            G.playMusic("GameMusic");
              //G.visualDebug = true;
              Sprite arenaBackground = new Sprite(-G.camera.x, -68 + ARENA_OFFSET_Y - 280);
              arenaBackground.loadGraphic("arenaBackground", 640, 640);
              arenaBackground.z = -10;
              //arenaBackground.screenPositioning = ScreenPositioning.Absolute;
              add(arenaBackground);

              Sprite arenaForeground = new Sprite(-G.camera.x, -68 + ARENA_OFFSET_Y);
              arenaForeground.loadGraphic("arenaForeground", 640, 360);
              arenaForeground.z = 9999;
              //arenaForeground.screenPositioning = ScreenPositioning.Absolute;
              add(arenaForeground);

              Sprite arenaVignette = new Sprite(0, 0);
              arenaVignette.loadGraphic("arenaVignette", 640, 360);
              arenaVignette.z = 10000;
              arenaVignette.screenPositioning = ScreenPositioning.Absolute;
              add(arenaVignette);

              Ball ball = new Ball();
              ball = new Ball(ARENA_WIDTH/2 - 30, ARENA_HEIGHT/2 - 30);
              add(ball);
              balls.add(ball);
              ball = new Ball(ARENA_WIDTH/2 + 20, ARENA_HEIGHT/2 - 30);
              add(ball);
              balls.add(ball);
              ball = new Ball(ARENA_WIDTH/2 - 30, ARENA_HEIGHT/2 + 15);
              add(ball);
              balls.add(ball);
              ball = new Ball(ARENA_WIDTH/2 + 20, ARENA_HEIGHT/2 + 15);
              add(ball);
              balls.add(ball);

              balls.Each((b) => {
            b.addOnMoveCallback(onBallMove);
              });

              teamPlayers.Add(Team.Left, new Group());
              teamPlayers.Add(Team.Right, new Group());

              //probably want to let people pick their team later
              teamPlayers[Team.Left].add(
            new Player(GameTracker.LeftPlayers[0], Team.Left, new Vector2(0, 0), CourtPosition.TopLeft));
              teamPlayers[Team.Left].add(
            new Player(GameTracker.LeftPlayers[1], Team.Left, new Vector2(0, 1), CourtPosition.BottomLeft));

              teamPlayers[Team.Right].add(
            new Player(GameTracker.RightPlayers[0], Team.Right, new Vector2(1, 0), CourtPosition.TopRight));
              teamPlayers[Team.Right].add(
            new Player(GameTracker.RightPlayers[1], Team.Right, new Vector2(1, 1), CourtPosition.BottomRight));

              teamPlayers[Team.Left].Each((player) => players.add(player));
              teamPlayers[Team.Right].Each((player) => players.add(player));
              players.Each((player) => add(player));

              hud = new HUD(players);
              hud.visible = false;
              add(hud);

              card = new Card();
              add(card);

              pauseGroup = new PauseGroup(card, onUnPause);
              add(pauseGroup);

              GameTracker.RoundSeconds = GameTracker.TotalSeconds;
        }