private static void CreateEffect(AnimClipData.EffectData animClipEffect) { EffectConf.EffectData data = LuaEffectConfModel.GetEffectData(animClipEffect.id); string path = Tool.GetAssetProjectPath(data.resourceName, Config.PrefabExtension, Config.SkillEffectPath); GameObject effectNode = LoadPrefab(Tool.ProjectPathToFullPath(path)); SetEffectTransform(data, effectNode); SetEffectParticle(animClipEffect.id, effectNode); m_dicIDEffectObject.Add(animClipEffect.id, effectNode); }
private static void SetPlayEffectTime(float sampleTime) { var listEffect = LuaAnimClipModel.ListEffect; for (ushort pairIndex = 0; pairIndex < listEffect.Count; pairIndex++) { float time = listEffect[pairIndex].Key; if (sampleTime < time) { break; } AnimClipData.EffectData[] datas = listEffect[pairIndex].Value; for (ushort dataIndex = 0; dataIndex < datas.Length; dataIndex++) { AnimClipData.EffectData data = datas[dataIndex]; if (data.type == AnimClipData.EffectType.Hit) { continue; } if (m_dicIDEffectObject.ContainsKey(data.id) && !m_dicIDEffectObject[data.id].activeSelf) { m_dicIDEffectObject[data.id].SetActive(true); } if (m_dicIDEffects.ContainsKey(data.id) && m_dicIDObjectNameDelay.ContainsKey(data.id)) { Dictionary <string, float> dicParticleNameTime = m_dicIDObjectNameDelay[data.id]; ParticleSystem[] particles = m_dicIDEffects[data.id]; for (ushort particleIndex = 0; particleIndex < particles.Length; particleIndex++) { ParticleSystem particle = particles[particleIndex]; if (!dicParticleNameTime.ContainsKey(particle.name)) { continue; } float simulateTime = time + dicParticleNameTime[particle.name] - Config.RuntimeEffectDelay; if (sampleTime >= simulateTime) { particle.Simulate(sampleTime - simulateTime); } else { particle.Simulate(0); } } } if (m_dicIDEffectAnimation.ContainsKey(data.id)) { SkillAnimator animation = m_dicIDEffectAnimation[data.id]; animation.SetStateAnimationPlayTime(sampleTime - time); } } } }