示例#1
0
    public static float BackNetLimetByType(float f, NetLimetType type = NetLimetType.保留2位)
    {
        float temp  = 0;
        int   index = (int)type;

        temp = (float)Math.Round(f, index);
        return(temp);
    }
示例#2
0
    /// <summary>
    /// 多位浮点转换成网络传输的少量浮点
    /// </summary>
    /// <param name="org"></param>
    /// <param name="type"></param>
    /// <returns></returns>
    public static NetVector3 BackNetLimetByType(Vector3 org, NetLimetType type = NetLimetType.保留2位)
    {
        NetVector3 back = new NetVector3(0, 0, 0);
        float      x    = BackNetLimetByType(org.x, type);
        float      y    = BackNetLimetByType(org.y, type);
        float      z    = BackNetLimetByType(org.z, type);

        back = new NetVector3(x, y, z);
        return(back);
    }