Example #1
0
 public void Move(Track track)
 {
     if (turns == speed || turns == -1)
     {
         TrackPoint nextLoc = trackPoint.next;
         if (nextLoc.addParticle(this))
         {
             trackPoint.removeParticle(this);
             trackPoint = nextLoc;
             if (speed < maxSpeed)
             {
                 ++speed;
             }
         }
         else
         {
             speed = Math.Max(0, speed - 1);
         }
         turns = maxTurns;
     }
     else
     {
         --turns;
     }
 }
Example #2
0
        public void Draw(SpriteBatch spriteBatch, TrackPoint tp)
        {
            if (tp == this)
            {
                if (!drawn)
                {
                    drawn = true;
                }
                else
                {
                    drawn = false;
                    return;
                }
            }
            next.Draw(spriteBatch, tp);

            foreach (Particle p in occupying)
            {
                Vector2 shift = new Vector2(0, 1);
                shift.Normalize();
                shift *= -10 * occupying.IndexOf(p);
                Color colour = maxThroughput < 3 ? Color.Red : Color.IndianRed;
                p.Draw(spriteBatch, rotate(loc + shift, 1), colour);
            }
        }
Example #3
0
 public Particle(TrackPoint startingPoint, int speed = 1)
 {
     this.maxSpeed = speed;
     this.speed = 1;
     startingPoint.addParticle(this);
     this.trackPoint = startingPoint;
     maxTurns = Math.Max(speed, maxTurns);
 }