|
|
@@ -14,33 +14,16 @@ namespace ET.Client
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //public class RollbackSystem: RollbackSystem<LSUnitViewComponent>
|
|
|
- //{
|
|
|
- // protected override void Rollback(LSUnitViewComponent self)
|
|
|
- // {
|
|
|
- // LSWorld lsWorld = self.GetParent<Room>().LSWorld;
|
|
|
- // foreach (LSUnitView child in self.Children.Values)
|
|
|
- // {
|
|
|
- // LSUnit unit = lsWorld.Get(child.Id) as LSUnit;
|
|
|
-//
|
|
|
- // Vector3 pos = child.Transform.position;
|
|
|
- // Vector3 to = unit.Position.ToVector();
|
|
|
- // float t = (to - pos).magnitude / 9f;
|
|
|
-//
|
|
|
- // child.Transform.position = pos;
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
-
|
|
|
public class UpdateSystem: UpdateSystem<LSUnitViewComponent>
|
|
|
{
|
|
|
protected override void Update(LSUnitViewComponent self)
|
|
|
{
|
|
|
- LSWorld lsWorld = self.GetParent<Room>().LSWorld;
|
|
|
- foreach (LSUnitView child in self.Children.Values)
|
|
|
+ Room room = self.GetParent<Room>();
|
|
|
+ LSWorld lsWorld = room.LSWorld;
|
|
|
+ foreach (long playerId in room.PlayerIds)
|
|
|
{
|
|
|
- LSUnit unit = lsWorld.Get(child.Id) as LSUnit;
|
|
|
-
|
|
|
+ LSUnit unit = lsWorld.Get(playerId) as LSUnit;
|
|
|
+ LSUnitView child = self.GetChild<LSUnitView>(playerId);
|
|
|
Vector3 pos = child.Transform.position;
|
|
|
Vector3 to = unit.Position.ToVector();
|
|
|
float distance = (to - pos).magnitude;
|