LSOperaComponentSystem.cs 1009 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using TrueSync;
  2. using UnityEngine;
  3. namespace ET.Client
  4. {
  5. [EntitySystemOf(typeof(LSOperaComponent))]
  6. [FriendOf(typeof(LSClientUpdater))]
  7. public static partial class LSOperaComponentSystem
  8. {
  9. [EntitySystem]
  10. private static void Awake(this ET.LSOperaComponent self)
  11. {
  12. }
  13. [EntitySystem]
  14. private static void Update(this LSOperaComponent self)
  15. {
  16. TSVector2 v = new();
  17. if (Input.GetKey(KeyCode.W))
  18. {
  19. v.y += 1;
  20. }
  21. if (Input.GetKey(KeyCode.A))
  22. {
  23. v.x -= 1;
  24. }
  25. if (Input.GetKey(KeyCode.S))
  26. {
  27. v.y -= 1;
  28. }
  29. if (Input.GetKey(KeyCode.D))
  30. {
  31. v.x += 1;
  32. }
  33. LSClientUpdater lsClientUpdater = self.GetParent<Room>().GetComponent<LSClientUpdater>();
  34. lsClientUpdater.Input.V = v.normalized;
  35. }
  36. }
  37. }