/// <summary> /// 加载完成后设置特效Object, 并把当前的特效状态更新给特效Object /// 这个函数设置为public是为了给特效浏览器使用 (SkillEffectBrowser). /// 除此之外, 外部不应该调用这个方法 /// </summary> /// <param name="effect"></param> public void _SetEffectAndUpdateEffectStatus(VFXController effect) { m_VFXController = effect; m_VFXController.CachedTransform.SetParent(CachedTransform, false); m_VFXController.SetEffectController(this); ReplayOperationsCached(); if (m_Status == EffectStatus.Playing) { m_StartTime = Time.time; m_VFXController.PlayFX(m_ForMainPlayer); LayerUtil.SetGameObjectToLayer(gameObject, GameConstant.LayerTypeID.TransparentFX, true); } else if (m_Status == EffectStatus.Stop) { ClearTimer(); m_VFXController.StopFX(true); } else if (m_Status == EffectStatus.Recycled) { // OnEffectLoadComplete里已经处理了 // m_VFXController.StopFX(true); // m_VFXController.ReleaseItem(); } m_OnEffectLoaded?.Invoke(this, usedata); }
public void PlayFX() { if (m_Status == EffectStatus.Stop || m_Status == EffectStatus.None) { m_Status = EffectStatus.Playing; m_StartTime = Time.time; ClearTimer(); if (m_VFXController != null) { m_VFXController.PlayFX(m_ForMainPlayer); } } }