// Token: 0x06000D26 RID: 3366 RVA: 0x0003B2BC File Offset: 0x000394BC
        private void Start()
        {
            EffectComponent component = base.GetComponent <EffectComponent>();
            Color           color     = (component.effectData != null) ? component.effectData.color : Color.white;

            for (int i = 0; i < this.particleSystems.Length; i++)
            {
                this.particleSystems[i].main.startColor = color;
                this.particleSystems[i].Play();
            }
        }
Beispiel #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();
         }
     }
 }
Beispiel #3
0
        // Token: 0x060014E4 RID: 5348 RVA: 0x00059280 File Offset: 0x00057480
        private void Start()
        {
            EffectComponent component = base.GetComponent <EffectComponent>();

            this.endPos = component.effectData.origin;
            Transform transform = component.effectData.ResolveChildLocatorTransformReference();

            this.startPos = (transform ? transform.position : component.effectData.start);
            if (this.reverse)
            {
                Util.Swap <Vector3>(ref this.endPos, ref this.startPos);
            }
            Vector3 vector = this.endPos - this.startPos;

            this.distanceTraveled = 0f;
            this.totalDistance    = Vector3.Magnitude(vector);
            if (this.totalDistance != 0f)
            {
                this.normal             = vector * (1f / this.totalDistance);
                base.transform.rotation = Util.QuaternionSafeLookRotation(this.normal);
            }
            else
            {
                this.normal = Vector3.zero;
            }
            if (this.beamObject)
            {
                this.beamObject.transform.position = this.startPos + vector * 0.5f;
                ParticleSystem component2 = this.beamObject.GetComponent <ParticleSystem>();
                if (component2)
                {
                    component2.shape.radius = this.totalDistance * 0.5f;
                    component2.Emit(Mathf.FloorToInt(this.totalDistance * this.beamDensity) - 1);
                }
            }
            if (this.startTransform)
            {
                this.startTransform.position = this.startPos;
            }
        }
        // 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());
        }
 // Token: 0x06000EB7 RID: 3767 RVA: 0x00048794 File Offset: 0x00046994
 public void SpawnEffect(GameObject effectPrefab, EffectData effectData, bool transmit)
 {
     if (transmit)
     {
         this.TransmitEffect(effectPrefab, effectData, null);
         if (NetworkServer.active)
         {
             return;
         }
     }
     if (NetworkClient.active)
     {
         if (!VFXBudget.CanAffordSpawn(effectPrefab))
         {
             return;
         }
         EffectData      effectData2 = effectData.Clone();
         EffectComponent component   = UnityEngine.Object.Instantiate <GameObject>(effectPrefab, effectData2.origin, effectData2.rotation).GetComponent <EffectComponent>();
         if (component)
         {
             component.effectData = effectData2.Clone();
         }
     }
 }