public virtual void Start(StarEffectType type) { int seed = (int)DateTime.Now.Ticks; for (int i = 0; i < GlobalValue.Dots_NUM; i++) { double size = GlobalValue.SIZE_MIN + (GlobalValue.SIZE_MAX - GlobalValue.SIZE_MIN) * GlobalValue.random.NextDouble(); double xVelocity = GlobalValue.X_VELOCITY - 2 * GlobalValue.X_VELOCITY * GlobalValue.random.NextDouble(); double yVelocity = -GlobalValue.Y_VELOCITY * GlobalValue.random.NextDouble(); Star star = null; switch (type) { case StarEffectType.YellowStar: star = new Star(GlobalValue.YellowStarImage, size); break; case StarEffectType.RedStar: star = new Star(GlobalValue.RedStarImage, size); break; case StarEffectType.ColorfullPiece: star = new Star(size); break; default: break; } star.Gravity = GlobalValue.GRAVITY; star.VelocityX = xVelocity; star.VelocityY = yVelocity; star.X = 22.5; star.Y = 22.5; _dotGroup.Add(star); Children.Insert(0, star); star.RunLoop(); } }