示例#1
0
        /// <summary>
        /// Creates a new score bar instance.
        /// </summary>
        /// <param name="game">The associated game object.</param>
        /// <param name="minValue">The score bar's minimal value.</param>
        /// <param name="maxValue">The score bar's maximal value.</param>
        /// <param name="position">The score bar's position.</param>
        /// <param name="height">The score bar's height.</param>
        /// <param name="width">The score bar's width.</param>
        /// <param name="scoreBarColor">Color to tint the scorebar's background with.</param>
        /// <param name="scoreBarOrientation">The score bar's orientation.</param>
        /// <param name="initialValue">The score bar's initial value.</param>
        /// <param name="screen">Gameplay screen where the score bar will appear.</param>
        /// <param name="isAppearAtCountDown">Whether or not the score bar will appear during the game's initial
        /// countdown phase.</param>
        public ScoreBar(Game game, int minValue, int maxValue, Vector2 position, int height, int width,
            Color scoreBarColor, ScoreBarOrientation scoreBarOrientation, int initialValue, GameplayScreen screen,
            bool isAppearAtCountDown)
            : base(game)
        {
            this.MinValue = minValue;
            this.MaxValue = maxValue;
            this.Position = position;
            this.ScoreBarColor = scoreBarColor;
            this.scoreBarOrientation = scoreBarOrientation;
            this.currentValue = initialValue;
            this.width = width;
            this.height = height;
            this.gameplayScreen = screen;
            this.isAppearAtCountDown = isAppearAtCountDown;

            spriteBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));

            GetSpaceFromBoarder();
        }
示例#2
0
        /// <summary>
        /// Creates a new score bar instance.
        /// </summary>
        /// <param name="game">The associated game object.</param>
        /// <param name="minValue">The score bar's minimal value.</param>
        /// <param name="maxValue">The score bar's maximal value.</param>
        /// <param name="position">The score bar's position.</param>
        /// <param name="height">The score bar's height.</param>
        /// <param name="width">The score bar's width.</param>
        /// <param name="scoreBarColor">Color to tint the scorebar's background with.</param>
        /// <param name="scoreBarOrientation">The score bar's orientation.</param>
        /// <param name="initialValue">The score bar's initial value.</param>
        /// <param name="screen">Gameplay screen where the score bar will appear.</param>
        /// <param name="isAppearAtCountDown">Whether or not the score bar will appear during the game's initial
        /// countdown phase.</param>
        public ScoreBar(Game game, int minValue, int maxValue, Vector2 position, int height, int width,
                        Color scoreBarColor, ScoreBarOrientation scoreBarOrientation, int initialValue, GameplayScreen screen,
                        bool isAppearAtCountDown)
            : base(game)
        {
            this.MinValue            = minValue;
            this.MaxValue            = maxValue;
            this.Position            = position;
            this.ScoreBarColor       = scoreBarColor;
            this.scoreBarOrientation = scoreBarOrientation;
            this.currentValue        = initialValue;
            this.width               = width;
            this.height              = height;
            this.gameplayScreen      = screen;
            this.isAppearAtCountDown = isAppearAtCountDown;


            scaledSpriteBatch = (ScaledSpriteBatch)Game.Services.GetService(typeof(ScaledSpriteBatch));

            GetSpaceFromBorder();
        }