IEnumerator Reverse() { while (state == ReplayState.Reverse) { int previousIndex = timeIndex; timeIndex--; int currentIndex = timeIndex; if (currentIndex < 0) { state = ReplayState.Pause; timeIndex = 0; } else { ReplayData prev, cur; prev.time = replay.TimeLookup(previousIndex); prev.messages = replay.MessagesLookup(previousIndex); cur.time = replay.TimeLookup(currentIndex); cur.messages = replay.MessagesLookup(currentIndex); ReplayEventData ed = new ReplayEventData(prev, cur); yield return(StartCoroutine(ReplayTransition(ed, false))); } } print("Finished Playing"); }
void HandleOnReplayTransition(ReplayEventData data) { TrackerMessage bodyMessage = SessionAnalyzer.LookupMessage(data.To.messages,"Player Skeleton"); if(bodyMessage != null) { EnableBody body = bodyMessage.Value as EnableBody; SetFromBody(body, data); } }
void HandleOnReplayTransition(ReplayEventData data) { TrackerMessage bodyMessage = SessionAnalyzer.LookupMessage(data.To.messages, "Player Skeleton"); if (bodyMessage != null) { EnableBody body = bodyMessage.Value as EnableBody; SetFromBody(body, data); } }
void SetFromBody(EnableBody body, ReplayEventData data) { Dictionary <string, EnableJoint> joints = body.Joints; // foreach(string jointName in joints.Keys) { // Transform bp = bodyDict[jointName]; // EnableJoint j = joints[jointName]; // bp.DOLocalRotate(j.orientation.eulerAngles, data.Duration); // bp.DOMove(j.position, data.Duration); // } }
void SetFromBody(EnableBody body, ReplayEventData data) { Dictionary<string, EnableJoint> joints = body.Joints; // foreach(string jointName in joints.Keys) { // Transform bp = bodyDict[jointName]; // EnableJoint j = joints[jointName]; // bp.DOLocalRotate(j.orientation.eulerAngles, data.Duration); // bp.DOMove(j.position, data.Duration); // } }
IEnumerator ReplayTransition(ReplayEventData ed, bool forward) { if (OnReplayTransition != null) { OnReplayTransition(ed); } float t; t = Mathf.Abs(ed.Duration); while (t > 0f) { t -= Time.deltaTime; if (forward) { elapsed += Time.deltaTime; } else { elapsed -= Time.deltaTime; } yield return(null); } }
IEnumerator Forward() { while (state == ReplayState.Forward) { int previousIndex = timeIndex; timeIndex++; int currentIndex = timeIndex; if (currentIndex >= replay.SessionDict.Keys.Count) { state = ReplayState.Pause; timeIndex = replay.SessionDict.Keys.Count - 1; } else { ReplayData prev, cur; prev.time = replay.TimeLookup(previousIndex); prev.messages = replay.MessagesLookup(previousIndex); cur.time = replay.TimeLookup(currentIndex); cur.messages = replay.MessagesLookup(currentIndex); ReplayEventData ed = new ReplayEventData(prev, cur); yield return(StartCoroutine(ReplayTransition(ed, true))); } } }
public ReplayAnalyzer(ReplayEventData inputData) { Input = inputData; SpawnEvent spawnEvent = new SpawnEvent(Input.OrderedSyncData[0]); Spawn = new TreeNode(spawnEvent); Spawn.RecentDirection = XYDirection.Undefined; FrontierNodes.Add(Spawn); while (FrontierNodes.Count > 0) { LastEvent = FrontierNodes.PopMin(); } }
IEnumerator Reverse() { while(state == ReplayState.Reverse) { int previousIndex = timeIndex; timeIndex--; int currentIndex = timeIndex; if(currentIndex < 0) { state = ReplayState.Pause; timeIndex = 0; } else { ReplayData prev, cur; prev.time = replay.TimeLookup(previousIndex); prev.messages = replay.MessagesLookup(previousIndex); cur.time = replay.TimeLookup(currentIndex); cur.messages = replay.MessagesLookup(currentIndex); ReplayEventData ed = new ReplayEventData(prev, cur); yield return StartCoroutine(ReplayTransition(ed, false)); } } print ("Finished Playing"); }
IEnumerator ReplayTransition(ReplayEventData ed, bool forward) { if(OnReplayTransition != null) { OnReplayTransition(ed); } float t; t = Mathf.Abs(ed.Duration); while(t > 0f) { t -= Time.deltaTime; if(forward) { elapsed += Time.deltaTime; } else { elapsed -= Time.deltaTime; } yield return null; } }
IEnumerator Forward() { while(state == ReplayState.Forward) { int previousIndex = timeIndex; timeIndex++; int currentIndex = timeIndex; if(currentIndex >= replay.SessionDict.Keys.Count) { state = ReplayState.Pause; timeIndex = replay.SessionDict.Keys.Count - 1; } else { ReplayData prev, cur; prev.time = replay.TimeLookup(previousIndex); prev.messages = replay.MessagesLookup(previousIndex); cur.time = replay.TimeLookup(currentIndex); cur.messages = replay.MessagesLookup(currentIndex); ReplayEventData ed = new ReplayEventData(prev, cur); yield return StartCoroutine(ReplayTransition(ed, true)); } } }