OperaComponentSystem.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using UnityEngine;
  3. namespace ET
  4. {
  5. public class OperaComponentAwakeSystem : AwakeSystem<OperaComponent>
  6. {
  7. public override void Awake(OperaComponent self)
  8. {
  9. self.mapMask = LayerMask.GetMask("Map");
  10. }
  11. }
  12. public class OperaComponentUpdateSystem : UpdateSystem<OperaComponent>
  13. {
  14. public override void Update(OperaComponent self)
  15. {
  16. self.Update();
  17. }
  18. }
  19. public static class OperaComponentSystem
  20. {
  21. public static void Update(this OperaComponent self)
  22. {
  23. if (Input.GetMouseButtonDown(1))
  24. {
  25. Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  26. RaycastHit hit;
  27. if (Physics.Raycast(ray, out hit, 1000, self.mapMask))
  28. {
  29. self.ClickPoint = hit.point;
  30. self.frameClickMap.X = self.ClickPoint.x;
  31. self.frameClickMap.Y = self.ClickPoint.y;
  32. self.frameClickMap.Z = self.ClickPoint.z;
  33. self.DomainScene().GetComponent<SessionComponent>().Session.Send(self.frameClickMap);
  34. }
  35. }
  36. }
  37. }
  38. }