public static void initMany(int count)
 {
     for (int i = 0; i < count; i++)
     {
         AsteroidObject g = Initialize();
         g.transform.LocalPosition = new Vector3(MainGameScreen.random.Next(-75, 75), MainGameScreen.random.Next(-50, 50), 0);
     }
 }
        new public static AsteroidObject Initialize()
        {
            AsteroidObject g;

            if (pool.Count > 0)
            {
                g = pool.FirstOrDefault();
                pool.Remove(g);
                SphereCollider s = new SphereCollider();
                s.Radius = 3;
                g.addBehavior(s);
            }
            else
            {
                g = new AsteroidObject();
            }
            g.Start();
            activeGameObjects.Add(g);

            return(g);
        }
Beispiel #3
0
 private void ResetAsteroids()
 {
     AsteroidObject.initMany(30);
 }