Beispiel #1
0
        void UpdateBuffer()
        {
            cnt += 1;
            if (cnt % 50 == 0)
            {
                int len     = ColorBallBuffer.GetRestAddlessSize();
                var states  = new BulletState[len];
                var options = new ColorBallOption[len];
                for (int i = 0; i < len; i++)
                {
                    states[i] =
                        new BulletState(
                            new Vector3(Random.Range(-3.0f, 3.0f), 0, 0),
                            new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(1.0f, 3.0f), 0),
                            _colorBallFunctions.GetRadius());
                    options[i] =
                        new ColorBallOption(
                            new Color(Random.Range(0.6f, 1.0f), Random.Range(0.4f, 0.8f), Random.Range(0.45f, 0.5f)));
                }
                ColorBallBuffer.Adder.AddBullets(states, options);
            }
            ColorBallBuffer.Update(Time.deltaTime);

            if (cnt % 60 == 0)
            {
                int len     = ColorBallBuffer2.GetRestAddlessSize();
                var states  = new BulletState[len];
                var options = new ColorBallOption[len];
                for (int i = 0; i < len; i++)
                {
                    states[i] =
                        new BulletState(
                            new Vector3(Random.Range(-3.0f, 3.0f), 0, 0),
                            new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(1.0f, 3.0f), 0),
                            _colorBallFunctions2.GetRadius());
                    options[i] =
                        new ColorBallOption(
                            new Color(Random.Range(0.6f, 1.0f), Random.Range(0.4f, 0.8f), Random.Range(0.45f, 0.5f)));
                }
                ColorBallBuffer2.Adder.AddBullets(states, options);
            }
            ColorBallBuffer2.Update(Time.deltaTime);
        }
Beispiel #2
0
 void Update()
 {
     cnt += 1;
     if (cnt % 50 == 0)
     {
         int len     = ColorBallBuffer.GetRestAddlessSize();
         var states  = new BulletState[len];
         var options = new ColorBallOption[len];
         for (int i = 0; i < len; i++)
         {
             states[i] =
                 new BulletState(
                     new Vector3(Random.Range(-10.0f, 10.0f), Random.Range(-10.0f, 10.0f), 0),
                     new Vector3(Random.Range(-1.0f, 1.0f), Random.Range(-1.0f, 1.0f), 0),
                     0.1f);
             options[i] =
                 new ColorBallOption(
                     new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f)));
         }
         ColorBallBuffer.Adder.AddBullets(states, options);
     }
     ColorBallBuffer.Update(Time.deltaTime);
 }