public float GetEffectHitTime(int effect_id, Beast caster, Beast target) { EffectData effectData = null; float result; if (!this.m_EffectDatas.ContainsKey(effect_id)) { result = 0f; } else { effectData = this.m_EffectDatas[effect_id]; float allTime = 0f; foreach (EffectInstanceData current in effectData.InstanceDatas) { float num2 = 0f; if (current.Type == EffectInstanceType.UITrace) { allTime = current.TraceTime; } if (current.Type == EffectInstanceType.Trace) { if (current.InstanceTraceMoveType == TraceMoveType.FixMoveSpeed) { Vector3 zero = Vector3.zero; Vector3 zero2 = Vector3.zero; if (null != caster) { EffectInstance.GetBindPos(caster, current.CasterBindType, out zero); } if (null != target) { EffectInstance.GetBindPos(target, current.TargetBindType, out zero2); } float num3 = Vector3.Magnitude(zero2 - zero); if (current.MoveSpeed != 0f) { num2 = num3 / current.MoveSpeed; } else { num2 = current.TraceTime; } } else { num2 = current.TraceTime; } } if (allTime < num2) { allTime = num2; } } allTime += effectData.HitPointTime; result = allTime; } return(result); }
public float GetEffectHitTime(int effect_id, Beast caster, Vector3 targetPos) { float result; if (!this.m_EffectDatas.ContainsKey(effect_id)) { result = 0f; } else { EffectData effectData = this.m_EffectDatas[effect_id]; float num = effectData.HitPointTime; foreach (EffectInstanceData current in effectData.InstanceDatas) { if (current.Type == EffectInstanceType.UITrace) { num = current.StartDelay + current.TraceTime; } float allTime; if (current.Type == EffectInstanceType.Trace) { if (current.InstanceTraceMoveType == TraceMoveType.FixMoveSpeed) { Vector3 zero = Vector3.zero; if (null != caster) { EffectInstance.GetBindPos(caster, current.CasterBindType, out zero); } float num2 = Vector3.Magnitude(targetPos - zero); if (current.MoveSpeed != 0f) { allTime = num2 / current.MoveSpeed + current.StartDelay; } else { allTime = current.StartDelay; } } else { allTime = current.StartDelay + current.TraceTime; } } else { allTime = current.StartDelay; } if (num < allTime) { num = allTime; } } result = num; } return(result); }