// Token: 0x0600053E RID: 1342 RVA: 0x00015300 File Offset: 0x00013500
 public static void SetEntries(EffectDef[] newEntries)
 {
     Array.Resize <EffectDef>(ref EffectCatalog.entries, newEntries.Length);
     Array.Copy(newEntries, EffectCatalog.entries, newEntries.Length);
     for (int i = 0; i < EffectCatalog.entries.Length; i++)
     {
         ref EffectDef ptr = ref EffectCatalog.entries[i];
         ptr.index = (EffectIndex)i;
         ptr.prefabEffectComponent.effectIndex = ptr.index;
     }
示例#2
0
 // Token: 0x0600055E RID: 1374 RVA: 0x00015BF4 File Offset: 0x00013DF4
 public static void SpawnEffect(EffectIndex effectIndex, EffectData effectData, bool transmit)
 {
     if (transmit)
     {
         EffectManager.TransmitEffect(effectIndex, effectData, null);
         if (NetworkServer.active)
         {
             return;
         }
     }
     if (NetworkClient.active)
     {
         if (effectData.networkSoundEventIndex != NetworkSoundEventIndex.Invalid)
         {
             PointSoundManager.EmitSoundLocal(NetworkSoundEventCatalog.GetAkIdFromNetworkSoundEventIndex(effectData.networkSoundEventIndex), effectData.origin);
         }
         EffectDef effectDef = EffectCatalog.GetEffectDef(effectIndex);
         if (effectDef == null)
         {
             return;
         }
         string spawnSoundEventName = effectDef.spawnSoundEventName;
         if (!string.IsNullOrEmpty(spawnSoundEventName))
         {
             PointSoundManager.EmitSoundLocal((AkEventIdArg)spawnSoundEventName, effectData.origin);
         }
         SurfaceDef surfaceDef = SurfaceDefCatalog.GetSurfaceDef(effectData.surfaceDefIndex);
         if (surfaceDef != null)
         {
             string impactSoundString = surfaceDef.impactSoundString;
             if (!string.IsNullOrEmpty(impactSoundString))
             {
                 PointSoundManager.EmitSoundLocal((AkEventIdArg)impactSoundString, effectData.origin);
             }
         }
         if (!VFXBudget.CanAffordSpawn(effectDef.prefabVfxAttributes))
         {
             return;
         }
         if (effectDef.cullMethod != null && !effectDef.cullMethod(effectData))
         {
             return;
         }
         EffectData      effectData2 = effectData.Clone();
         EffectComponent component   = UnityEngine.Object.Instantiate <GameObject>(effectDef.prefab, effectData2.origin, effectData2.rotation).GetComponent <EffectComponent>();
         if (component)
         {
             component.effectData = effectData2.Clone();
         }
     }
 }
        // Token: 0x0600053D RID: 1341 RVA: 0x00015200 File Offset: 0x00013400
        private static EffectDef[] GetDefaultEffectDefs()
        {
            GameObject[]     array = Resources.LoadAll <GameObject>("Prefabs/Effects/");
            List <EffectDef> list  = new List <EffectDef>(array.Length);

            foreach (GameObject gameObject in array)
            {
                EffectComponent component = gameObject.GetComponent <EffectComponent>();
                if (!component)
                {
                    Debug.LogErrorFormat(gameObject, "Error registering effect \"{0}\": Prefab does not have EffectComponent attached.", new object[]
                    {
                        gameObject
                    });
                }
                else
                {
                    EffectDef item = new EffectDef
                    {
                        prefab = gameObject,
                        prefabEffectComponent = component,
                        prefabVfxAttributes   = gameObject.GetComponent <VFXAttributes>(),
                        prefabName            = gameObject.name,
                        spawnSoundEventName   = component.soundName
                    };
                    list.Add(item);
                }
            }
            for (int j = 0; j < list.Count; j++)
            {
                if (list[j].prefabName.Equals("CoinEmitter"))
                {
                    list[j].cullMethod = ((EffectData effectData) => SettingsConVars.cvExpAndMoneyEffects.value);
                    break;
                }
            }
            return(list.ToArray());
        }