public static MapVector2 FromCoordinate(GameCmd.Coordinate x, GameCmd.Coordinate y) { float xx = x.integral + (float)x.mydecimal / SMALL_POS_OFFSET; float yy = y.integral + (float)y.mydecimal / SMALL_POS_OFFSET; return(new MapVector2(xx, yy)); }
public static GameCmd.Coordinate ToCoordinate(float v) { var val = new GameCmd.Coordinate(); val.integral = (ushort)v; val.mydecimal = (byte)((v - (float)val.integral) * SMALL_POS_OFFSET); return(val); }