protected virtual void OnDestroy()
 {
     if (Instance == this)
     {
         Instance = null;
         if (mPools != null)
         {
             mPools.ClearWithCallback((x) => x.Clear());
         }
     }
 }
Exemplo n.º 2
0
 private void Update()
 {
     if (mLife >= 0 && isAlive)
     {
         mLife -= Time.deltaTime;
         if (mLife <= 0)
         {
             isAlive = false;
             EffectsManager.UnSpawnEffect(this);
         }
     }
 }
Exemplo n.º 3
0
 public virtual void Deactive()
 {
     if (isAlive)
     {
         if (!m_JustActiveParticles)
         {
             if (gameObject != null && gameObject.activeSelf)
             {
                 gameObject.SetActive(false);
             }
         }
         else if (mSelfPartcle != null)
         {
             mSelfPartcle.Stop(m_ActiveChildParticle);
         }
         isAlive = false;
         EffectsManager.UnSpawnEffect(this);
     }
 }
 protected virtual void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         mPools   = new AvlTree <Pool>((x) => x.PoolId);
         if (m_PreloadAssets != null)
         {
             for (int i = 0; i < m_PreloadAssets.Length; i++)
             {
                 AddPrefabs(m_PreloadAssets[i]);
             }
         }
         if (m_DontDestroyOnLoad)
         {
             DontDestroyOnLoad(gameObject);
         }
     }
     else
     {
         gameObject.SetActive(false);
         name = name + "-unused";
     }
 }