public IEnumerator <Coroutine> LoadInternal() //TODO Load function { Time.timeScale = 0; string path = IslePath;//Path.Combine(Application.persistentDataPath, isleName); using (BinaryReader reader = new BinaryReader(File.OpenRead(Path.Combine(path, "thumbnail.dat")))) { isleX = reader.ReadInt32(); isleZ = reader.ReadInt32(); } using (BinaryReader reader = new BinaryReader(File.OpenRead(Path.Combine(path, "world.dat")))) { int header = reader.ReadInt32(); if (header <= 0) { Clock.Instance.currentTimeOfDay = reader.ReadSingle(); } } using (BinaryReader reader = new BinaryReader(File.OpenRead(Path.Combine(path, "map.dat")))) { int header = reader.ReadInt32(); if (header <= 2) { yield return(StartCoroutine(grid.Load(reader, header))); topCam.ValidatePosition(); } else { Debug.LogWarning("Unknown map format " + header); } } yield return(StartCoroutine(entities.Load(path))); Time.timeScale = 1; IslandView.SetActive(false); }
public void Load() //TODO Load function { string path = Path.Combine(Application.persistentDataPath, isleName); using (BinaryReader reader = new BinaryReader(File.OpenRead(Path.Combine(path, "world.dat")))) { int header = reader.ReadInt32(); if (header <= 0) { Clock.Instance.currentTimeOfDay = reader.ReadSingle(); } } using (BinaryReader reader = new BinaryReader(File.OpenRead(Path.Combine(path, "map.dat")))) { int header = reader.ReadInt32(); if (header <= 2) { grid.Load(reader, header); topCam.ValidatePosition(); } else { Debug.LogWarning("Unknown map format " + header); } } entities.Load(path); }