public void StartExplosion(Vector2 pos)
    {
        AsteroidExplosion explosion = Instantiate(asteroidExplosionPrefab, explosionContainer, false);

        explosion.transform.position = pos;
        explosion.Play();
    }
示例#2
0
 // Use this for initialization
 void Awake()
 {
     getExplosion     = this;
     pooledExplosions = new List <GameObject> ();
     for (int i = 0; i < poolMax; i++)
     {
         GameObject ASexplosion = (GameObject)Instantiate(poolExpl);
         ASexplosion.transform.parent = transform;
         ASexplosion.SetActive(false);
         pooledExplosions.Add(ASexplosion);
     }
 }
 // Use this for initialization
 void Awake()
 {
     //Make the static ref to this
     getExplosion = this;
     //Make a new Gameobject pool
     pooledExplosions = new List <GameObject> ();
     //Put a total of the PoolMax in de pool
     for (int i = 0; i < poolMax; i++)
     {
         //Temporary GameObject to store the PooledObj
         GameObject ASexplosion = (GameObject)Instantiate(poolExpl);
         //Make this the Asteroids parent
         ASexplosion.transform.parent = transform;
         //Set the Pooled GameObject to inactive
         ASexplosion.SetActive(false);
         //Add the Pooled GameObject to the Pool
         pooledExplosions.Add(ASexplosion);
     }
 }