private void OnEnable() { var data = writer.Data; var update = new BaseUnitPosture.Update(); update.Interval = IntervalCheckerInitializer.InitializedChecker(inter); if (!data.Initialized) { update.Root = this.transform.rotation.ToCompressedQuaternion(); var dic = new Dictionary <PosturePoint, PostureData>(); foreach (var k in unit.GetKeys()) { var pos = new PostureData(k, unit.GetAllRotates(k)); dic.Add(pos.Point, pos); } update.Posture = new PostureInfo() { Datas = dic }; update.Initialized = true; } writer.SendUpdate(update); }
private void OnEnable() { reader.OnPostureChangedEvent += PostureChanged; // initialize var data = reader.Data; this.transform.rotation = data.Root.ToUnityQuaternion(); foreach (var k in unit.GetKeys()) { PostureData pos; if (data.Posture.Datas.TryGetValue(k, out pos)) { int index = 0; foreach (var r in pos.Rotations) { unit.SetQuaternion(k, index, r.ToUnityQuaternion()); index++; } } } }