private void StartLoopFX() { m_IsFadedIn = true; if (m_FadeInFX != null) { m_FadeInFX.Destroy(); m_FadeInFX = null; } if (m_LoopFX != null) { m_LoopFX.Begin(m_Lifetime, EffectArguments); } if (!String.IsNullOrEmpty(m_LoopAudioID)) { m_LoopSound = AudioController.Play(m_LoopAudioID, EffectArguments.TargetTransform); } }
public override void Destroy() { if (!m_IsFinished) { LegacyLogic.Instance.EventManager.UnregisterEvent(m_RemoveEventType, new EventHandler(OnRemoveEvent)); } if (m_IsStarted) { if (!m_IsFinished) { m_IsFinished = true; if (m_FadeInFX != null) { m_FadeInFX.Destroy(); m_FadeInFX = null; } if (m_LoopFX != null) { m_LoopFX.Destroy(); m_LoopFX = null; } StopLoopSound(); if (!String.IsNullOrEmpty(m_FadeOutAudioID)) { AudioController.Play(m_FadeOutAudioID, EffectArguments.TargetTransform); } if (m_FadeOutFX != null) { m_FadeOutFX.Begin(m_Lifetime, EffectArguments); m_FadeOutFX.Destroy(); m_FadeOutFX = null; } } } else { Debug.LogError("BuffFX: Destroy called before Begin! Destroy call skipped!"); } base.Destroy(); }
public override void Begin(Single p_lifetime, FXArgs p_args) { base.Begin(p_lifetime, p_args); if (m_FadeInFX == null && m_LoopFX == null && m_FadeOutFX == null) { Debug.LogError("BuffFX: Begin: no FX specified!"); } else { if (m_FadeInFX != null) { m_FadeInFX = Helper.Instantiate <FXBase>(m_FadeInFX); } if (m_LoopFX != null) { m_LoopFX = Helper.Instantiate <FXBase>(m_LoopFX); } if (m_FadeOutFX != null) { m_FadeOutFX = Helper.Instantiate <FXBase>(m_FadeOutFX); } } if (m_FadeInFX != null) { m_FadeInFX.Begin(p_lifetime, p_args); } if (!String.IsNullOrEmpty(m_FadeInAudioID)) { AudioController.Play(m_FadeInAudioID, EffectArguments.TargetTransform); } m_IsStarted = true; if (m_DestroyFadeInAfter != -1f) { m_DestroyFadeInAfter += Time.deltaTime; } }