Example #1
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();
         }
     }
 }
Example #2
0
 private static void Init()
 {
     SurfaceDefCatalog.SetSurfaceDefs(Resources.LoadAll <SurfaceDef>("SurfaceDefs/"));
 }