Ejemplo n.º 1
0
 public void Add(PrimitiveObject obj)
 {
     if (isUpdating)
         addList.Add(obj);
     else
         objList.Add(obj);
 }
Ejemplo n.º 2
0
        private void CreateMoonAndStars()
        {
            Vector2 moonPosition = new Vector2(300, 100);
            int starCount = 300;

            PrimitiveObject moon;
            moon = new PrimitiveObject(moonPosition, Art.moon, Color.LightYellow);
            Add(moon);

            Random rand = new Random();

            for (int i = 0; i < starCount; i++)
                Add(Star.getInstance(rand));
        }
Ejemplo n.º 3
0
        void createPoints()
        {
            ColorConversion.ColorHSL oldColor = ColorConversion.ColorConversion.RGBtoHSL(color);

            for (int i = 0; i < pointsNumber; i++)
            {
                float speed = (float)rand.NextDouble() * pointsSpeed * ((float)pointsNumber / (pointsMin + pointsAdd));
                float angle = (float)(rand.NextDouble() * Math.PI * 2);
                Vector2 Speed = new Vector2((float)Math.Sin(angle), (float)Math.Cos(angle)) * speed;
                Speed += speedVect;
                Color col = new Color(color.R + rand.Next(-colorDev, colorDev),
                    color.G + rand.Next(-colorDev, colorDev), color.B + rand.Next(-colorDev, colorDev), 255);

                PrimitiveObject obj = new PrimitiveObject(position, .05f, (float)Math.Atan2(Speed.Y, Speed.X), Speed.Length(),
                    Art.point, col, .03f, .0002f);
                obj.scale = new Vector2((float)rand.NextDouble() * .4f + .4f);

                Game1.control.Add(obj);
            }
        }
Ejemplo n.º 4
0
 void createTrial()
 {
     for (int i = 0; i < 3; i++)
     {
         if (rand.Next(0, 1) == 0)
         {
             float newAngle = angle - (float)Math.PI + (float)((rand.NextDouble() - .5) * Math.PI / 3);
             float newSpeed = (.05f + (float)rand.NextDouble() / 6) * speed;
             PrimitiveObject obj = new PrimitiveObject(position, .001f, newAngle, newSpeed, Art.point, color, 0, .001f);
             obj.scale = new Vector2(.5f);
             Game1.control.Add(obj);
         }
     }
 }
Ejemplo n.º 5
0
 public static bool isDelete(PrimitiveObject obj)
 {
     return obj.forDelete;
 }