|
@@ -22,119 +22,45 @@ namespace ET
|
|
|
{
|
|
|
foreach (var obj in UnitMgr.Instance.AllUnits)
|
|
|
{
|
|
|
- if (obj is BattleUnit || obj is BattleSpell)
|
|
|
+ if (obj is BattleUnit)
|
|
|
{
|
|
|
- /*if(obj is BattleSpell spell)
|
|
|
+ var zo = obj.ZoneObject;
|
|
|
+ VecTmp.Set(zo.X, zo.Y, zo.Z);
|
|
|
+ if (!VecTmp.Equal(obj.LastPos, 0.01f) || MathF.Abs(obj.LastRotation - zo.Direction) > 0.01f)
|
|
|
{
|
|
|
- var zs = spell.ZoneSpell;
|
|
|
- if (zs.Info.MType == CommonAI.Zone.SpellTemplate.MotionType.Foxfire)
|
|
|
- {
|
|
|
- if(zs.Target.ObjectID == 0 || zs.PassTimeMS > zs.Info.LifeTimeMS + 5000)
|
|
|
- {
|
|
|
- PostMsg2Layer(new RemoveObjectEvent(zs.ObjectID));
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- else if(zs.PassTimeMS > zs.Info.LifeTimeMS + 150)
|
|
|
+ EventSystem.Instance.Publish<SyncUnitPosEvent>(SyncUnitPosEvent.Static.Clone(zo.ObjectID, VecTmp, zo.Direction));
|
|
|
+ obj.LastPos.Set(VecTmp);
|
|
|
+ obj.LastRotation = zo.Direction;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(obj is BattleSpell)
|
|
|
+ {
|
|
|
+ var zs = obj.ZoneObject as ZoneSpell;
|
|
|
+ /*
|
|
|
+ if (zs.Info.MType == CommonAI.Zone.SpellTemplate.MotionType.Foxfire)
|
|
|
+ {
|
|
|
+ if (zs.Target.ObjectID == 0 || zs.PassTimeMS > zs.Info.LifeTimeMS + 5000)
|
|
|
{
|
|
|
PostMsg2Layer(new RemoveObjectEvent(zs.ObjectID));
|
|
|
return;
|
|
|
}
|
|
|
+ }
|
|
|
+ else if (zs.PassTimeMS > zs.Info.LifeTimeMS + 150)
|
|
|
+ {
|
|
|
+ PostMsg2Layer(new RemoveObjectEvent(zs.ObjectID));
|
|
|
+ return;
|
|
|
}*/
|
|
|
-
|
|
|
- var zo = obj.ZoneObject;
|
|
|
- VecTmp.Set(zo.X, zo.Y, zo.Z);
|
|
|
- if (!VecTmp.Equal(obj.LastPos, 0.01f) || MathF.Abs(obj.LastRotation - zo.Direction) > 0.01f)
|
|
|
+ VecTmp.Set(zs.X, zs.Y, zs.Z);
|
|
|
+ if (!VecTmp.Equal(obj.LastPos, 0.01f) || MathF.Abs(obj.LastRotation - zs.Direction) > 0.01f)
|
|
|
{
|
|
|
- EventSystem.Instance.Publish<SyncUnitPosEvent>(SyncUnitPosEvent.Static.Clone(zo.ObjectID, VecTmp, zo.Direction));
|
|
|
+ EventSystem.Instance.Publish<SyncUnitPosEvent>(SyncUnitPosEvent.Static.Clone(zs.ObjectID, VecTmp, zs.Direction, zs.RotationX));
|
|
|
obj.LastPos.Set(VecTmp);
|
|
|
- obj.LastRotation = zo.Direction;
|
|
|
+ obj.LastRotation = zs.Direction;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 灵魂出窍的 Y 轴更新,一定是有目标的法术
|
|
|
- /// </summary>
|
|
|
- /// <param name="curPos"></param>
|
|
|
- /// <returns></returns>
|
|
|
- /*private float UpdateY(Vector3 curPos)
|
|
|
- {
|
|
|
- if (this.TargetUnit == null || this.TargetUnit.GameObject == null)
|
|
|
- {
|
|
|
- this.TargetPos = this.DefaultTargetPos;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- // 有单位目标.
|
|
|
- // 目标点为单位的胸部挂载点.
|
|
|
- // 这里需要高度调整
|
|
|
- //GameObject gameobj = this.TargetUnit.RUnit.GetTargetPart(RenderUnit.PART_CHEST_BUFF);
|
|
|
- GameObject gameobj = this.TargetUnit.RUnit.RootTransform.gameObject;
|
|
|
-
|
|
|
- //this.TargetPos = this.TargetUnit.GameObject.transform.position;
|
|
|
- this.TargetPos = gameobj.transform.position;
|
|
|
-
|
|
|
- if (gameobj != null)
|
|
|
- {
|
|
|
- this.TargetPos.y = gameobj.transform.position.y;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- float Total = Vector3.Distance(this.mOriginPos, this.TargetPos);
|
|
|
- if (Total != 0)
|
|
|
- {
|
|
|
- float curState = Vector3.Distance(this.mOriginPos, curPos);
|
|
|
-
|
|
|
- float p = curState / Total;
|
|
|
- float factor = Mathf.Clamp01(p);
|
|
|
-
|
|
|
- return Vector3.Lerp(this.mOriginPos, this.TargetPos, factor).y;
|
|
|
- }
|
|
|
-
|
|
|
- return curPos.y;
|
|
|
- }*/
|
|
|
-
|
|
|
- /*/更新cannon spell的Y
|
|
|
- private float UpdateCannonPos(Vector3 curPos)
|
|
|
- {
|
|
|
- this.TargetPos = this.DefaultTargetPos;
|
|
|
-
|
|
|
- //施法者都被移除了,还放个毛啊
|
|
|
- if (this.LauncherUnit == null || this.LauncherUnit.GameObject == null)
|
|
|
- {
|
|
|
- return this.TargetPos.y;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- float Total = Vector3.Distance(
|
|
|
- this.LauncherUnit.GameObject.transform.position,
|
|
|
- this.TargetPos);
|
|
|
- if (Total == 0)
|
|
|
- {
|
|
|
- return curPos.y;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- float self = Vector3.Distance(
|
|
|
- this.LauncherUnit.GameObject.transform.position,
|
|
|
- curPos);
|
|
|
-
|
|
|
- float factor = Mathf.Clamp01(1 - self / Total);
|
|
|
-
|
|
|
- if (this.ZSpell.Info.ParabolaHeight != 0)
|
|
|
- {
|
|
|
- float sinheight = Mathf.Sin((1 - factor) * Mathf.PI);
|
|
|
-
|
|
|
- return this.ZSpell.LaunchHeight * factor + sinheight * this.ZSpell.Info.ParabolaHeight + AddHeight;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return this.ZSpell.LaunchHeight * factor + AddHeight;
|
|
|
- }
|
|
|
- }
|
|
|
- }*/
|
|
|
}
|
|
|
}
|