LSOperaComponentSystem.cs 1.1 KB

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