public SerializationFlags Deserialize(VitalsData vdata, byte[] buffer, ref int bitposition, bool keyframe) { var datas = vdata.datas; bool isComplete = true; bool hasChanged = false; for (int i = 0; i < vitalCount; ++i) { datas[i] = vitalDefs[i].Deserialize(buffer, ref bitposition, keyframe); /// We are using float.NegativeInfinity to indicate null, rather than a nullable struct if (datas[i].Value == float.NegativeInfinity) { isComplete = false; } else { hasChanged |= true; } } return (isComplete ? SerializationFlags.IsComplete | SerializationFlags.HasChanged : hasChanged?SerializationFlags.HasChanged: SerializationFlags.None); }
public void Apply(VitalsData vdata) { var datas = vdata.datas; for (int i = 0; i < vitalCount; ++i) { vitalArray[i].Apply(datas[i]); } }
public void CopyFrom(VitalsData source) { var srcdatas = source.datas; int cnt = srcdatas.Length; for (int i = 0; i < cnt; ++i) { datas[i] = srcdatas[i]; } }
public SerializationFlags Serialize(VitalsData vdata, VitalsData lastVData, byte[] buffer, ref int bitposition, bool keyframe) { var currdatas = vdata.datas; var lastdatas = lastVData.datas; SerializationFlags flags = SerializationFlags.None; for (int i = 0; i < vitalCount; ++i) { flags |= vitalDefs[i].Serialize(currdatas[i], lastdatas[i], buffer, ref bitposition, keyframe); } return(flags); }
public override void OnAwake() { base.OnAwake(); vitalArray = vitals.VitalArray; vitalsCount = vitals.vitalDefs.Count; rootVital = vitalArray[0]; /// subscribe to callbacks to Vitals changes vitals.onVitalChangeCallbacks.Add(this); lastSentData = new VitalsData(vitals); for (int i = 0; i < vitalsCount; ++i) { vitalArray[i].ResetValues(); } defaultMountingMask = 1 << (defaultMounting.id); }
public Frame(int frameId, Vitals vitals) : base(frameId) { vitalsData = new VitalsData(vitals); }