示例#1
0
        // TODO: To save we should create a dictionary of leveldata:tiledjsonleveldata

        public ILevelData LoadLevel(string levelName)
        {
            TextAsset levelJson = Resources.Load <TextAsset>(Path.Combine(basePath, levelName));

            if (levelJson == null)
            {
                Debug.LogError(string.Format("Level {0} could not be found. Creating a default one.", levelName));
                ILevelData levelData = new LevelData(10, 10);
                levelData.name = levelName;

                return(levelData);
            }

            TiledJsonLevelData tiledData = JsonUtility.FromJson <TiledJsonLevelData>(levelJson.text);

            return(tiledData.ToLevelData());
        }
示例#2
0
 public TiledJsonLevelData(ILevelData modified, TiledJsonLevelData original)
 {
     throw new System.NotImplementedException("Tiled Json Data can't merge levels yet.");
 }