public void SaveGhost(LapStat ls) { GhostDataSerial[] Gst; int SavedFrameCount = FrameCount; Gst = new GhostDataSerial[ls.finFr - ls.stFr]; for (int f = ls.stFr; f < ls.finFr; f++) { GhostDataSerial gf = new GhostDataSerial(); RecFrameData rfdg = this.Data[f][PlayerCarId]; gf.Pos = new Vector3Serial(rfdg.Pos); gf.Rot = new QuaternionSerial(rfdg.Rot); Gst[f - ls.stFr] = gf; } string nameOfTheFileToSave = Application.persistentDataPath + "/" + Game.current.Filename + ".gst"; BinaryFormatter bf = new BinaryFormatter(); FileStream file; file = File.Create(nameOfTheFileToSave); bf.Serialize(file, Gst); file.Close(); }
void ShowBestLap() { _bestLap = Race.Current.LapStats.OrderBy(ls => ls.time).First(); transform.Find("txtBestLapTime").GetComponent <Text>().text = GenFunc.HMS(_bestLap.time); }