using ET;
using UnityEngine;

public static class RenderUtils
{
    public static int MapHeight
    {
        get
        {
            var layer = BattleMgr.Instance.Layer;
            return layer == null ? 0 : layer.Data.Terrain.ZoneData.TotalHeight;
        }
    }

    private static UnityEngine.Vector3 vecTemp;
    public static UnityEngine.Vector3 UnityPosFromBattle(CommonLang.Geometry.Vector3 pos)
    {
        vecTemp.Set(pos.X, pos.Z, MapHeight - pos.Y);
        return vecTemp;
    }
    public static UnityEngine.Vector3 UnityPosFromBattle(UnityEngine.Vector3 pos)
    {
        vecTemp.Set(pos.x, pos.z, MapHeight - pos.y);
        return vecTemp;
    }

    public static UnityEngine.Quaternion UnityRotationFromBattle(float rotation, float rotationX = 0f)
    {
        vecTemp.Set(-rotationX * Mathf.Rad2Deg, rotation * Mathf.Rad2Deg + 90, 0);
        return Quaternion.Euler(vecTemp);
    }
}