UnitHelper.cs 744 B

123456789101112131415161718
  1. namespace ET.Client
  2. {
  3. public static class UnitHelper
  4. {
  5. public static Unit GetMyUnitFromClientScene(Scene clientScene)
  6. {
  7. PlayerComponent playerComponent = clientScene.GetComponent<PlayerComponent>();
  8. Scene currentScene = clientScene.GetComponent<CurrentScenesComponent>().Scene;
  9. return currentScene.GetComponent<UnitComponent>().Get(playerComponent.MyId);
  10. }
  11. public static Unit GetMyUnitFromCurrentScene(Scene currentScene)
  12. {
  13. PlayerComponent playerComponent = currentScene.Parent.GetParent<Scene>().GetComponent<PlayerComponent>();
  14. return currentScene.GetComponent<UnitComponent>().Get(playerComponent.MyId);
  15. }
  16. }
  17. }