Exemplo n.º 1
0
        private void setupGameOverText(LostSoulWorld world)
        {
            var center   = new Vector2(world.PlayField.Center.X, world.PlayField.Center.Y);
            var label    = new HudElementText(world.Game, "Game Over");
            var position = center - label.RenderBehavior.Size / 2.0f;

            position.Y -= label.RenderBehavior.Size.Y;
            label.BodyBehavior.Position = position;
            label.Color = gameOverTextColor;
            gameOverTextBackground.AddChild(label);
        }
Exemplo n.º 2
0
        private void setupGameOverTextBackground(LostSoulWorld world)
        {
            gameOverTextBackground = new HudElement(world.Game);
            var center = gameOverHud.BodyBehavior.Size * 0.5f;
            var size   = new Vector2(200.0f, 200.0f);

            gameOverTextBackground.BodyBehavior.Size     = size;
            gameOverTextBackground.BodyBehavior.Position = new Vector2(
                center.X - size.X / 2.0f,
                center.Y - size.Y / 2.0f);
            var render = new PrimitiveRectangleRenderBehavior(gameOverTextBackground);

            var color = Color.Black;

            color.A      = (int)(255.0 * 0.8);
            render.Color = color;
            gameOverTextBackground.RenderBehavior = render;
            gameOverHud.AddChild(gameOverTextBackground);
        }
Exemplo n.º 3
0
        void OnGameOverChangedHandler(object sender, EventArgs e)
        {
            var world = (LostSoulWorld)sender;

            gameHud.Visible     = !world.IsGameOver();
            gameOverHud.Visible = world.IsGameOver();
            if (world.IsGameOver())
            {
                scoreLabel.Color = gameOverTextColor;
                gameOverHud.AddChild(scoreLabel);
            }
            else
            {
                scoreLabel.Color = textColor;
                gameHud.AddChild(scoreLabel);
            }
        }