예제 #1
0
    void FixedUpdate()
    {
        if (replay == null)
        {
            return;
        }

        PlayerReplaySnapshot snapshot = new PlayerReplaySnapshot();

        if (replay.GetSnapshot(snapshotIndex, ref snapshot))
        {
            Vector3 position = transform.position;
            Vector3 rotation = transform.eulerAngles;

            position   = snapshot.position;
            rotation.z = snapshot.rotation;

            transform.eulerAngles = rotation;
            transform.position    = position;

            snapshotIndex++;
        }
        else
        {
            EndReplay();
        }
    }
예제 #2
0
 public bool GetSnapshot(int index, ref PlayerReplaySnapshot snapshot)
 {
     if (index < snapshots.Count)
     {
         snapshot = snapshots[index];
         return(true);
     }
     else
     {
         return(false);
     }
 }