/// <summary> /// Copy a raw flake from this wrapper's nugget to a specified Flake in Unity. /// </summary> /// <param name="i">Index of the Protocol.Flake in this nugget to copy.</param> /// <param name="flake">Target Flake.</param> public void CopyToFlake(int i, Flake flake) { flake.vector3s = new Vector3[data.Flakes(i).Value.Vector3sLength]; for (int j = 0; j < data.Flakes(i).Value.Vector3sLength; ++j) { flake.vector3s[j] = new Vector3( data.Flakes(i).Value.Vector3s(j).Value.X, data.Flakes(i).Value.Vector3s(j).Value.Y, data.Flakes(i).Value.Vector3s(j).Value.Z ); } flake.vector4s = new Quaternion[data.Flakes(i).Value.Vector4sLength]; for (int j = 0; j < data.Flakes(i).Value.Vector4sLength; ++j) { flake.vector4s[j] = new Quaternion( data.Flakes(i).Value.Vector4s(j).Value.X, data.Flakes(i).Value.Vector4s(j).Value.Y, data.Flakes(i).Value.Vector4s(j).Value.Z, data.Flakes(i).Value.Vector4s(j).Value.W ); } flake.floats = new float[data.Flakes(i).Value.FloatsLength]; for (int j = 0; j < data.Flakes(i).Value.FloatsLength; ++j) { flake.floats[j] = data.Flakes(i).Value.Floats(j); } flake.ints = new int[data.Flakes(i).Value.IntsLength]; for (int j = 0; j < data.Flakes(i).Value.IntsLength; ++j) { flake.ints[j] = data.Flakes(i).Value.Ints(j); } flake.bytes = new byte[data.Flakes(i).Value.BytesLength]; for (int j = 0; j < data.Flakes(i).Value.BytesLength; ++j) { flake.bytes[j] = (byte)data.Flakes(i).Value.Bytes(j); } flake.text = data.Flakes(i).Value.Text; }
/// <summary> /// Reset the flake data. A necessary override to allocate the optional members beforehand. /// </summary> public virtual void ResetData() { data = new Flake(); }