예제 #1
0
 void SavePathwaPos()
 {
     for (int c = 1; c <= 50; c++)
     {
         posData data     = new posData();
         float   currTime = c * Duration / smooth;
         Vector3 currPos  = mSplineInterp.GetHermiteAtTime(currTime);
         data.pos  = currPos;
         data.Time = currTime;
         posList.Add(data);
     }
 }
예제 #2
0
    public void SavePos()
    {
        BinaryFormatter bf   = new BinaryFormatter();
        FileStream      file = File.Create(Application.persistentDataPath + "/posdata.dat");

        posData data = new posData();

        data.x = usr.transform.position.x;

        bf.Serialize(file, data);
        file.Close();
        Debug.Log(usr.transform.position.x);
    }
예제 #3
0
    public void loadPos()
    {
        if (File.Exists(Application.persistentDataPath + "/posdata.dat"))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/posdata.dat", FileMode.Open);

            posData data = (posData)bf.Deserialize(file);
            file.Close();

            Vector3 temp = player.transform.position;
            temp.x = data.x;
            player.transform.position = temp;
        }
    }