コード例 #1
0
ファイル: Snakez.cs プロジェクト: romeguarin/XNAZuneGames
        void updateScore(FoodType food)
        {
            BaseTextType text = hud.getText("Add Score Number");

            if (!text.DrawText)
            {
                text.changeNumber(food.Score);
                text.startText(time);
            }
            else
            {
                text.addToNumber(food.Score);
            }

            score += food.Score;

            hud.getText("Score Number").changeNumber(score);
        }
コード例 #2
0
ファイル: Snakez.cs プロジェクト: romeguarin/XNAZuneGames
        //This region contains all HUD data
        #region HUD data
        void initializeHUD()
        {
            hud = new HUDComponent(this, GraphicsDevice);

            BaseTextType temp;

            temp = new BaseTextType("Score:", "Fonts/LindseySmall", new Vector2(10, 5), Color.Blue);
            hud.addText(temp);

            temp = new BaseTextType("Score Number", "Fonts/LindseySmall", new Vector2(55, 5), Color.Blue);
            temp = new NumberWrapper(temp, score);
            hud.addText(temp);

            temp = new BaseTextType("Lives:", "Fonts/LindseySmall", new Vector2(100, 5), Color.Blue);
            hud.addText(temp);

            temp = new BaseTextType("Lives Number", "Fonts/LindseySmall", new Vector2(145, 5), Color.Blue);
            temp = new NumberWrapper(temp, lives);
            hud.addText(temp);

            temp = new BaseTextType("Level:", "Fonts/LindseySmall", new Vector2(170, 5), Color.Blue);
            hud.addText(temp);

            temp = new BaseTextType("Level Number", "Fonts/LindseySmall", new Vector2(220, 5), Color.Blue);
            temp = new NumberWrapper(temp, levelNumber);
            hud.addText(temp);

            temp = new BaseTextType("Add Score Number", "Fonts/LindseySmall", new Vector2(60, 15), Color.Yellow);
            temp = new NumberWrapper(temp, 0);
            temp = new FloatWrapper(temp, new Vector2(0, 3), 1.0f);
            temp = new FadeWrapper(temp, 1.0f, -1);
            temp = new ScaleWrapper(temp, 1.02f, 1.0f, 1.0f);
            hud.addText(temp);

            Components.Add(hud);
        }