private void createBallon(int i, int j, int length) { float l = length * 25f; float percentage = (float)j / (float)length * l; Vector2 pos = new Vector2((Position.X - l / 2) + percentage + 10, getY(length, j) + Position.Y - 40 - (i * 25)); float rotation = (float)Math.Atan2(pos.Y - bike.Position.Y, pos.X - bike.Position.X) + MathHelper.PiOver2; float degree = MathHelper.ToDegrees(rotation); float layerDepth = Math.Abs((bike.Position.X - pos.X) / l) / 10f + 0.1f; Random r = new Random(i * j * length); float chordLength = (Position - pos).Length(); Chord c = new Chord(pos, chordLength, rotation + MathHelper.ToRadians(180)); Ballon b = new Ballon(pos, rotation, Ballon.colors[counter % Ballon.colors.Length], true, c); b.Acc = bike.Acc; b.Velocity = bike.Velocity; b.addListener(this); b.Max = 1f; counter++; b.LayerDepth = layerDepth; Ballons.Add(b); }
public void pop(Ballon b) { ballons.Remove(b); }