public static FOWData DeSerialize(IDataIn dataIn) { int mapSize = dataIn.ReadInt(); int tileSize = dataIn.ReadInt(); float terrainHeight = dataIn.ReadFloat(); Vector3 offset = new Vector3(dataIn.ReadFloat(), dataIn.ReadFloat(), dataIn.ReadFloat()); int nodeCount = dataIn.ReadInt(); Dictionary <Point2D, IFOWNode> nodes = new Dictionary <Point2D, IFOWNode>(nodeCount); for (int i = 0; i < nodeCount; i++) { Point2D key = Point2D.DeSerialize(dataIn); FOWNode value = FOWNode.DeSerialize(dataIn); nodes.Add(key, value); } int camoCount = dataIn.ReadInt(); Dictionary <Point2D, float> camoNodes = new Dictionary <Point2D, float>(camoCount); for (int i = 0; i < camoCount; i++) { Point2D key = Point2D.DeSerialize(dataIn); float value = dataIn.ReadFloat(); camoNodes.Add(key, value); } return(new FOWData(mapSize, tileSize, terrainHeight, offset, nodes, camoNodes)); }
public static Point2D DeSerialize(IDataIn dataIn) { Point2D instance = new Point2D(); instance.x = dataIn.ReadByte(); instance.y = dataIn.ReadByte(); return(instance); }
public static FOWNode DeSerialize(IDataIn dataIn) { int length = dataIn.ReadInt(); Point2D[] points = new Point2D[length]; byte[] distances = new byte[length]; for (int i = 0; i < length; i++) { byte dist = dataIn.ReadByte(); Point2D point = Point2D.DeSerialize(dataIn); distances[i] = dist; points[i] = point; } return(new FOWNode(points, distances)); }
public Product(IDataIn DataIn) { this._DataIn = DataIn; }