public override void LoadFrame(string binarySave) { byte[] byteArray = Convert.FromBase64String(binarySave); MemoryStream mf = new MemoryStream(byteArray); BinaryFormatter bf = new BinaryFormatter(); SphereFrameData data = (SphereFrameData)bf.Deserialize(mf); id = new Guid(data.id); transform.position = VectorArrayConverter.arrayToVector3(data.position); transform.rotation = Quaternion.Euler(VectorArrayConverter.arrayToVector3(data.rotation)); }
public override string MakeFrame() { BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); SphereFrameData data = new SphereFrameData(); data.id = new Byte[id.ToByteArray().Length]; id.ToByteArray().CopyTo(data.id, 0); data.position = VectorArrayConverter.vector3ToArray(transform.position); data.rotation = VectorArrayConverter.vector3ToArray(transform.rotation.eulerAngles); bf.Serialize(ms, data); return(Convert.ToBase64String(ms.ToArray())); }