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(); } }
public bool GetSnapshot(int index, ref PlayerReplaySnapshot snapshot) { if (index < snapshots.Count) { snapshot = snapshots[index]; return(true); } else { return(false); } }