예제 #1
0
 public void AddUIElement(Texture2D tex, float lifetimeSeconds, Vector2 offsetFromParent_Start, Vector2 offsetFromParent_End, Color color_Start, Color color_End, float scale_Start, float scale_End, float delay)
 {
     WorldSpaceUIElement element = new WorldSpaceUIElement(tex, lifetimeSeconds, offsetFromParent_Start, offsetFromParent_End, color_Start, color_End, scale_Start, scale_End, delay);
     agentUISprites.Add(element);
 }
예제 #2
0
        /// <summary>
        /// Updates the background screen. Unlike most screens, this should not
        /// transition off even if it has been covered by another screen: it is
        /// supposed to be covered, after all! This overload forces the
        /// coveredByOtherScreen parameter to false in order to stop the base
        /// Update method wanting to transition off.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
            bool coveredByOtherScreen)
        {
            subtitleText.Update(gameTime);

            nextBGText -= (float)gameTime.ElapsedGameTime.TotalSeconds;
            nextBGClear -= (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (nextBGClear <= 0.0f)
            {
                nextBGClear = nextBGClearMax;
                bgText.ClearAllUpcoming();
                for (int i = 0; i < bgText.GetMaxLines(); i++)
                {
                    bgText.AddItem(new HackGameBoard_BackgroundTextItem(new StringBuilder(" "), 0, bgText.defaultStartColor, bgText.defaultEndColor, bgText.defaultColorFadeTime));
                }
                nextBGText = nextBGTextMax;
            }

            if (nextBGText <= 0.0f)
            {
                //throw a bg text line
                nextBGText = MathHelper.Lerp(nextBGTextMin, nextBGTextMax, (float)r.NextDouble());
                HackGameBoard_BackgroundTextItem bgnext = bgTextStrings[r.Next(0, bgTextStrings.Count)];
                bgText.AddItem(bgnext);
            }
            bgText.UpdateSelf(gameTime);
            base.Update(gameTime, otherScreenHasFocus, false);

            ping_Delay -= (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (ping_Delay <= 0.0f)
            {
                ping_Delay = ping_Delay_Max;
                Vector2 location = new Vector2(MathHelper.Lerp(0, ScreenManager.GraphicsDevice.Viewport.Width, (float)r.NextDouble()),
                    MathHelper.Lerp(0, ScreenManager.GraphicsDevice.Viewport.Height, (float)r.NextDouble()));
                ping_Element = new WorldSpaceUIElement(ping_Texture, 2.0f, location,location, new Color(0.0f, 1.0f, 0, 0.0f), new Color(0.0f, 0, 0, 0), 0.2f, 10.0f, 3.0f);
            }

            if (ping_Element != null)
            {
                ping_Element.UpdateState(gameTime, null);
            }
        }
예제 #3
0
 public void AddUIElement(Texture2D tex, float lifetimeSeconds, Vector2 offsetFromParent, float delay)
 {
     WorldSpaceUIElement element = new WorldSpaceUIElement(tex, lifetimeSeconds, offsetFromParent, delay);
     agentUISprites.Add(element);
 }