Beispiel #1
0
 private void RemoveAllRemoveableEffects()
 {
     for (int i = 0; i < this._effectLs.Count; i++)
     {
         BaseMonoEffect effect = this._effectLs[i];
         if (effect.IsToBeRemove())
         {
             this.RemoveEffectByRuntimeID(effect.GetRuntimeID(), i);
             i--;
         }
     }
 }
Beispiel #2
0
        public BaseMonoEffect CreateEffectInstance(string effectPath, bool isLocal, Vector3 initPos, Vector3 faceDir, Vector3 initScale)
        {
            BaseMonoEffect item = null;
            GameObject     obj2;

            if (this.mute)
            {
                return(null);
            }
            this._effectPrefabCache.TryGetValue(effectPath, out obj2);
            if (obj2 == null)
            {
                obj2 = Miscs.LoadResource <GameObject>(EffectData.GetPrefabResPath(effectPath), BundleType.RESOURCE_FILE);
                this._effectPrefabCache.Add(effectPath, obj2);
            }
            bool       isFromEffectPool = false;
            GameObject obj3             = null;

            if (this._effectPool != null)
            {
                GameObject obj4 = this._effectPool.Spawn(obj2);
                if (obj4 != null)
                {
                    obj3 = obj4;
                }
            }
            isFromEffectPool = obj3 != null;
            if (!isFromEffectPool)
            {
                obj3 = UnityEngine.Object.Instantiate <GameObject>(obj2);
                obj3.transform.parent = this.GetEffectRootOutsidePool();
                obj3.name             = obj2.name;
            }
            item = obj3.GetComponent <BaseMonoEffect>();
            item.Init(effectPath, Singleton <RuntimeIDManager> .Instance.GetNextNonSyncedRuntimeID(5), initPos, faceDir, initScale, isFromEffectPool);
            item.Setup();
            if (item == null)
            {
                throw new Exception("Invalid Type or State!");
            }
            this._effectLs.Add(item);
            this._effectDict.Add(item.GetRuntimeID(), item);
            return(item);
        }