protected override void OnCreateManager() { base.OnCreateManager(); m_entityManager = World.Active.GetOrCreateManager <EntityManager>(); m_vfxSystem = World.Active.GetOrCreateManager <VFXSystem>(); }
/// <summary> /// Gets the safe name of a VFXSystem (for serialization / enum). /// </summary> /// <param name="vfx">The VFXSystem to get the name for.</param> /// <returns>The actual, serialization-safe name.</returns> public static string GetSafeVFXName(VFXSystem vfx) { var safeName = vfx.transform.GetGameObjectPath().Trim(); safeName = safeName.Replace("(Clone)", "").Replace(" (1)", "").Replace(" ", "_"); safeName = Serializer.ReplaceInvalidChars(safeName); safeName = safeName.Substring(1, safeName.Length - 1); return(safeName); }
private void DestroyRocket(int i) { if (GameManager.instance.PlayRocketVFX) { VFXSystem.PlayVFXExplode(m_rocketStateGroup.Positions[i].Value); } m_vfxSystem.RemoveRocketVFXAtEntity(i); }
/// <summary> /// Helper to take a VFXSystem and get the VFXSystemPrefabs enum value for it (if valid). /// </summary> /// <param name="vfx">The vfx system</param> public static VFXPrefabs GetVFXSystemEnum(VFXSystem vfx) { if (Enum.TryParse(GetSafeVFXName(vfx), out VFXPrefabs name)) { return(name); } SL.Log("PlayVFX: could not get name for " + vfx.name); return(VFXPrefabs.NONE); }
// Update is called once per frame void Update() { if (curTime >= curInterval) { var vfx = VFXSystem.GetInstance(); if (vfx) { var randomRange = Random.Range(rangeMin, rangeMax); var randomPos = centerOfHost.transform.position + Random.insideUnitSphere * randomRange; vfx.PlayEffect(effectTag, randomPos, Quaternion.identity); } curInterval = Random.Range(randomIntervalMin, randomInvtervalMax); curTime = 0; } curTime += Time.deltaTime; }