LSInputComponentSystem.cs 602 B

123456789101112131415161718192021222324
  1. using System;
  2. using ET.Client;
  3. using TrueSync;
  4. namespace ET
  5. {
  6. public static partial class LSInputComponentSystem
  7. {
  8. [EntitySystem]
  9. public static void LSUpdate(this LSInputComponent self)
  10. {
  11. LSUnit unit = self.GetParent<LSUnit>();
  12. TSVector2 v2 = self.LSInput.V * 6 * 50 / 1000;
  13. if (v2.LengthSquared() < 0.0001f)
  14. {
  15. return;
  16. }
  17. TSVector oldPos = unit.Position;
  18. unit.Position += new TSVector(v2.x, 0, v2.y);
  19. unit.Forward = unit.Position - oldPos;
  20. }
  21. }
  22. }