Пример #1
0
    public GhostDataSerial Serialize()
    {
        GhostDataSerial rtn = new GhostDataSerial();

        rtn.Pos = new Vector3Serial(Pos);
        rtn.Rot = new QuaternionSerial(Rot);
        return(rtn);
    }
Пример #2
0
    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();
    }