コード例 #1
0
 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");
 }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
    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);
        }
    }
コード例 #4
0
    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);
//		}
    }
コード例 #5
0
 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);
     //		}
 }
コード例 #6
0
    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);
        }
    }
コード例 #7
0
 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)));
         }
     }
 }
コード例 #8
0
ファイル: ReplayAnalyzer.cs プロジェクト: EklipZgit/furkiebot
        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();
            }
        }
コード例 #9
0
 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");
 }
コード例 #10
0
 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;
     }
 }
コード例 #11
0
 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));
         }
     }
 }