|
@@ -16,7 +16,7 @@ namespace ET.Client
|
|
|
public override void OnEvent(PlayEffectEvent args)
|
|
|
{
|
|
|
vecTemp.Set(args.Pos.X, args.Pos.Y, args.Pos.Z);
|
|
|
- EffectMgr.Instance.PlayEffect(args.Effect, args.HostId, vecTemp, args.Time, args.Rotation).Coroutine();
|
|
|
+ EffectMgr.Instance.PlayEffect(args.Effect, args.HostId, vecTemp, args.Rotation).Coroutine();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -45,9 +45,10 @@ namespace ET.Client
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public async ETTask<uint> PlayEffect(LaunchEffect effect, uint HostId, Vector3 pos, float time = 0f, float rotation = 0f)
|
|
|
+ public async ETTask<uint> PlayEffect(LaunchEffect effect, uint HostId, Vector3 pos, float rotation = 0f)
|
|
|
{
|
|
|
var starttime = Time.realtimeSinceStartup;
|
|
|
+ float time = EffectPlayInfo.TIME_DEFAULT;
|
|
|
|
|
|
GameObject go = null;
|
|
|
if (!effect.Name.IsNullOrWhitespace())
|
|
@@ -64,9 +65,23 @@ namespace ET.Client
|
|
|
}
|
|
|
|
|
|
go = await GameObjectPool.Instance.Acquire("Effect_" + effect.Name);
|
|
|
- var timeComponent = go.GetComponent<EffectTime>();
|
|
|
- if (time == 0f) time = timeComponent != null ? timeComponent.duration : EffectPlayInfo.TIME_DEFAULT;
|
|
|
- if (time < 0f) time = EffectPlayInfo.TIME_FOREVER;
|
|
|
+
|
|
|
+ if (effect.EffectTimeMS > 0)
|
|
|
+ {
|
|
|
+ time = effect.EffectTimeMS / 1000.0f;
|
|
|
+ }
|
|
|
+ else if (effect.EffectTimeMS < 0)
|
|
|
+ {
|
|
|
+ time = EffectPlayInfo.TIME_FOREVER;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var timeComponent = go.GetComponent<EffectTime>();
|
|
|
+ if (timeComponent != null && timeComponent.duration > 0)
|
|
|
+ {
|
|
|
+ time = timeComponent.duration;
|
|
|
+ }
|
|
|
+ }
|
|
|
setupEffect(go, effect, render, pos, rotation);
|
|
|
}
|
|
|
else if(!effect.SoundName.IsNullOrWhitespace())
|