コード例 #1
0
 public void Update(float dt)
 {
     for (int index = 0; index < this.Lines.Count; ++index)
     {
         MovingBarsEffect.BarLine line = this.Lines[index];
         line.TimeRemaining -= dt;
         if ((double)line.TimeRemaining <= 0.0)
         {
             line.Current           = line.Next;
             line.Next              = Utils.randm(1f);
             line.TotalTimeThisStep = this.MinLineChangeTime + Utils.randm(this.MaxLineChangeTime - this.MinLineChangeTime);
             line.TimeRemaining     = line.TotalTimeThisStep;
         }
         this.Lines[index] = line;
     }
 }
コード例 #2
0
        public void Draw(SpriteBatch sb, Rectangle bounds, float minHeight, float lineWidth, float lineSeperation, Color drawColor)
        {
            int   num1 = 0;
            float num2 = 0.0f;

            while ((double)num2 + (double)lineWidth < (double)bounds.Width)
            {
                ++num1;
                num2 += lineWidth + lineSeperation;
            }
            bool flag = false;

            while (this.Lines.Count - 1 < num1)
            {
                this.Lines.Add(new MovingBarsEffect.BarLine()
                {
                    TimeRemaining = -1f
                });
                flag = true;
            }
            if (flag)
            {
                this.Update(0.0f);
            }
            float x = (float)bounds.X;

            for (int index = 0; index < num1; ++index)
            {
                MovingBarsEffect.BarLine line = this.Lines[index];
                float     num3   = Utils.QuadraticOutCurve((float)(1.0 - (double)line.TimeRemaining / (double)line.TotalTimeThisStep));
                float     num4   = line.Current + (line.Next - line.Current) * num3;
                float     num5   = (float)bounds.Height - minHeight;
                int       height = (int)((double)minHeight + (double)num5 * (double)num4);
                Rectangle destinationRectangle = new Rectangle((int)x, bounds.Y + bounds.Height - height, (int)lineWidth, height);
                if (this.IsInverted)
                {
                    destinationRectangle.Y = bounds.Y;
                }
                sb.Draw(Utils.white, destinationRectangle, drawColor);
                x += lineWidth + lineSeperation;
            }
        }