Ejemplo n.º 1
0
        private void setupGameHud(LostSoulWorld world)
        {
            gameHud = new HudElement(world.Game);
            root.AddChild(gameHud);

            scoreLabel       = new HudElementText(world.Game);
            scoreLabel.Color = textColor;
            gameHud.AddChild(scoreLabel);

            lostSoulsLabel       = new HudElementText(world.Game);
            lostSoulsLabel.Color = textColor;
            lostSoulsLabel.BodyBehavior.Position = new Vector2(200.0f, 0.0f);
            gameHud.AddChild(lostSoulsLabel);

            difficultyLabel       = new HudElementText(world.Game);
            difficultyLabel.Text  = "Difficulty: 100%";
            difficultyLabel.Color = textColor;
            difficultyLabel.BodyBehavior.Position = new Vector2(300.0f, 0.0f);
            gameHud.AddChild(difficultyLabel);

            helpLabel       = new HudElementText(world.Game);
            helpLabel.Text  = "F - Fullscreen";
            helpLabel.Color = textColor;
            helpLabel.BodyBehavior.Position = new Vector2(300.0f + difficultyLabel.BodyBehavior.Size.X + 15.0f, 0.0f);
            gameHud.AddChild(helpLabel);

            gameHud.RenderBehavior = new PrimitiveRectangleRenderBehavior(gameHud)
            {
                Color = new Color(0.0f, 0.0f, 0.0f, 0.4f)
            };
            gameHud.BodyBehavior.Position = Vector2.Zero;
            gameHud.BodyBehavior.Size     = helpLabel.BodyBehavior.Position + helpLabel.BodyBehavior.Size + new Vector2(5.0f, 2.0f);
        }
Ejemplo n.º 2
0
        private void setupGameOverInstructions(LostSoulWorld world)
        {
            var center   = new Vector2(world.PlayField.Center.X, world.PlayField.Center.Y);
            var label    = new HudElementText(world.Game, "Press RMB to restart or Escape to exit.");
            var position = center - label.RenderBehavior.Size / 2.0f;

            position.Y += label.RenderBehavior.Size.Y;
            label.BodyBehavior.Position = position;
            label.Color = gameOverTextColor;
            gameOverTextBackground.AddChild(label);
        }