RenderUtils.cs 917 B

1234567891011121314151617181920212223242526272829303132
  1. using ET;
  2. using UnityEngine;
  3. public static class RenderUtils
  4. {
  5. public static int MapHeight
  6. {
  7. get
  8. {
  9. var layer = BattleMgr.Instance.Layer;
  10. return layer == null ? 0 : layer.Data.Terrain.ZoneData.TotalHeight;
  11. }
  12. }
  13. private static UnityEngine.Vector3 vecTemp;
  14. public static UnityEngine.Vector3 UnityPosFromBattle(CommonLang.Geometry.Vector3 pos)
  15. {
  16. vecTemp.Set(pos.X, pos.Z, MapHeight - pos.Y);
  17. return vecTemp;
  18. }
  19. public static UnityEngine.Vector3 UnityPosFromBattle(UnityEngine.Vector3 pos)
  20. {
  21. vecTemp.Set(pos.x, pos.z, MapHeight - pos.y);
  22. return vecTemp;
  23. }
  24. public static UnityEngine.Quaternion UnityRotationFromBattle(float rotation, float rotationX = 0f)
  25. {
  26. vecTemp.Set(-rotationX * Mathf.Rad2Deg, rotation * Mathf.Rad2Deg + 90, 0);
  27. return Quaternion.Euler(vecTemp);
  28. }
  29. }