public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Update(gameTime);

            if (m_Delay > 0)
            {
                m_Delay -= gameTime.ElapsedGameTime.Milliseconds;
            }

            for (int i = 0; i < m_Items.Count; i++)
            {
                m_Items[i].Update(gameTime);
                if (i == m_Index)
                {
                    m_Items[i].ColorTarget = COLOR_SELECTED;
                    if (!TPMath.IsWithinRange(m_Items[i].Scale, SCALE_SELECTED, 0.05f))
                    {
                        m_Items[i].Scale += TPMath.GetDirectionVector(m_Items[i].Scale, SCALE_SELECTED) / 10;
                    }
                }
                else
                {
                    m_Items[i].ColorTarget = COLOR_UNSELECTED;
                    if (!TPMath.IsWithinRange(m_Items[i].Scale, SCALE_UNSELECTED, 0.05f))
                    {
                        m_Items[i].Scale += TPMath.GetDirectionVector(m_Items[i].Scale, SCALE_UNSELECTED) / 10;
                    }
                }
                m_Items[i].Position.Y = this.Position.Y + OffsetY * i;
                m_Items[i].Position.X = this.Position.X;
                TPMath.ShiftTowardsColor(ref m_Items[i].RenderColor, ref m_Items[i].ColorTarget, 5);
            }
        }
Exemple #2
0
        public override void Update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.Update(gameTime);
            if (m_Delay > 0)
            {
                m_Delay -= gameTime.ElapsedGameTime.Milliseconds;
            }
            foreach (TPRollingTextMenuItem item in m_MenuItemSet)
            {
                item.Update(gameTime);
                if (!TPMath.IsWithinRange(item.Position, item.PositionTarget, 5.0f))
                {
                    item.Velocity = TPMath.GetDirectionVector(item.Position, item.PositionTarget) * 5;
                }
                else
                {
                    item.Velocity = Vector2.Zero;
                }

                if (item.Alpha < item.AlphaTarget)
                {
                    item.Alpha += 0.01f;
                }

                if (item.Alpha > item.AlphaTarget)
                {
                    item.Alpha -= 0.01f;
                }
                item.RenderColor = new Color((item.ColorTarget.R / 255) * item.Alpha, (item.ColorTarget.G / 255) * item.Alpha, (item.ColorTarget.B / 255) * item.Alpha, item.Alpha);

                if (!TPMath.IsWithinRange(item.Scale, item.ScaleTarget, 0.1f))
                {
                    item.Scale += TPMath.GetDirectionVector(item.Scale, item.ScaleTarget) / 20;
                }
            }
        }