Пример #1
0
 public void Release()
 {
     if (pool != null)
     {
         pool.Free(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     life -= Time.deltaTime;
     if (life <= 0)
     {
         if (pool != null)
         {
             pool.Free(gameObject);
         }
         else
         {
             Destroy(this);
         }
     }
 }