Ejemplo n.º 1
0
    public void LoadGame()
    {
        if (!File.Exists(filePath))
        {
            return;
        }

        BinaryFormatter bf = new BinaryFormatter();
        //open file for write varibale
        FileStream     fs       = new FileStream(filePath, FileMode.Open);
        Save           save     = (Save)bf.Deserialize(fs);
        Tuning         tuning   = GetComponent <Tuning>();
        CarSpawnerTest carSpawn = GetComponent <CarSpawnerTest>();

        if (tuning)
        {
            tuning.LoadData(save);
        }
        if (carSpawn)
        {
            carSpawn.LoadData(save);
        }
        //close file
        fs.Close();
    }
Ejemplo n.º 2
0
 private void Start()
 {
     garageUI = GetComponent <CarSpawnerTest>();
 }