public override void LoadDiffFrame(string binarySave) { byte[] byteArray = Convert.FromBase64String(binarySave); MemoryStream mf = new MemoryStream(byteArray); BinaryFormatter bf = new BinaryFormatter(); SphereDiffFrameData data = (SphereDiffFrameData)bf.Deserialize(mf); transform.position = VectorArrayConverter.arrayToVector3(data.position); transform.rotation = Quaternion.Euler(VectorArrayConverter.arrayToVector3(data.rotation)); }
public void LoadFrame(string binarySave) { byte[] byteArray = Convert.FromBase64String(binarySave); MemoryStream mf = new MemoryStream(byteArray); BinaryFormatter bf = new BinaryFormatter(); EnemyFrameData data = (EnemyFrameData)bf.Deserialize(mf); id = new Guid(data.id); hasBeenKilled = data.hasBeenKilled; transform.position = VectorArrayConverter.arrayToVector3(data.position); transform.rotation = Quaternion.Euler(VectorArrayConverter.arrayToVector3(data.rotation)); }
public override string MakeDiffFrame() { BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); SphereDiffFrameData data = new SphereDiffFrameData(); data.position = VectorArrayConverter.vector3ToArray(transform.position); data.rotation = VectorArrayConverter.vector3ToArray(transform.rotation.eulerAngles); bf.Serialize(ms, data); return(Convert.ToBase64String(ms.ToArray())); }
public override void LoadFrame(string binarySave) { byte[] byteArray = Convert.FromBase64String(binarySave); MemoryStream mf = new MemoryStream(byteArray); BinaryFormatter bf = new BinaryFormatter(); BulletBaseFrameSave data = (BulletBaseFrameSave)bf.Deserialize(mf); id = new Guid(data.id); transform.position = VectorArrayConverter.arrayToVector3(data.position); transform.rotation = Quaternion.Euler(VectorArrayConverter.arrayToVector3(data.rotation)); direction = VectorArrayConverter.arrayToVector3(data.direction); speed = data.speed; }
public string MakeDiffFrame(Guid killer) { BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); PlayerDiffFrameData frameData = new PlayerDiffFrameData(); frameData.position = VectorArrayConverter.vector3ToArray(transform.position); frameData.rotation = VectorArrayConverter.vector3ToArray(transform.rotation.eulerAngles); frameData.killerGUID = new Byte[killer.ToByteArray().Length]; killer.ToByteArray().CopyTo(frameData.killerGUID, 0); bf.Serialize(ms, frameData); return(Convert.ToBase64String(ms.ToArray())); }
public override string MakeFrame() { BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); PlayerBaseFrameData frameData = new PlayerBaseFrameData(); frameData.id = new Byte[id.ToByteArray().Length]; id.ToByteArray().CopyTo(frameData.id, 0); frameData.position = VectorArrayConverter.vector3ToArray(transform.position); frameData.rotation = VectorArrayConverter.vector3ToArray(transform.rotation.eulerAngles); bf.Serialize(ms, frameData); return(Convert.ToBase64String(ms.ToArray())); }
public override void LoadDiffFrame(string binarySave) { byte[] byteArray = Convert.FromBase64String(binarySave); MemoryStream mf = new MemoryStream(byteArray); BinaryFormatter bf = new BinaryFormatter(); PlayerDiffFrameData data = (PlayerDiffFrameData)bf.Deserialize(mf); transform.position = VectorArrayConverter.arrayToVector3(data.position); transform.rotation = Quaternion.Euler(VectorArrayConverter.arrayToVector3(data.rotation)); if (data.killerGUID != null) { killerGUID = new Guid(data.killerGUID); if (GameObjectStateManager.Instance.doesParentExist(killerGUID)) { Destroy(killerGUID); } } }
public override string MakeFrame() { BinaryFormatter bf = new BinaryFormatter(); MemoryStream ms = new MemoryStream(); BulletBaseFrameSave data = new BulletBaseFrameSave(); data.id = new Byte[id.ToByteArray().Length]; id.ToByteArray().CopyTo(data.id, 0); data.speed = speed; data.position = VectorArrayConverter.vector3ToArray(transform.position); data.rotation = VectorArrayConverter.vector3ToArray(transform.rotation.eulerAngles); data.direction = VectorArrayConverter.vector3ToArray(transform.forward); bf.Serialize(ms, data); return(Convert.ToBase64String(ms.ToArray())); }