Beispiel #1
0
    private explosion_fx InstantiateFX(float x, float y)
    {
        GameObject fxGo = (GameObject)Instantiate(fxPrefab.gameObject,
                                                  new Vector3(x, -y, -1f),
                                                  Quaternion.identity);
        explosion_fx fxTemp = fxGo.GetComponent <explosion_fx>();

        fxTemp.my_garbage = this;
        return(fxTemp);
    }
Beispiel #2
0
 public void ShowExplosion(float x, float y)
 {
     if (_explosionStack.Count > 0) //if you can recycle a previous fx
     {
         _explosionStack.Pop().Show_me(new Vector3(x, -y, -1f));
     }
     else //create a new fx
     {
         explosion_fx fx_temp = InstantiateFX(x, y);
         fx_temp.Activate_me(this);
     }
 }
Beispiel #3
0
 void Start()
 {
     //Precreate
     if (fxPrefab != null && isAlive)
     {
         for (int i = 0; i < 4; ++i)
         {
             explosion_fx fx = InstantiateFX(0.0f, 0.0f);
             fx.gameObject.SetActive(false);
             _explosionStack.Push(fx);
         }
     }
 }
Beispiel #4
0
 public void GoBack(explosion_fx fx)
 {
     _explosionStack.Push(fx);
 }