Commit 41c1d2da authored by 18손재민's avatar 18손재민

맵 데이터 json파일로 저장 기능 구현 완료, 로드 작업 중

parent f51f20bf
fileFormatVersion: 2
guid: ef75a379c7ec93a4d85966c580bcc286
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2a181461c3622c14b804bb5eabec750c
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Any:
second:
enabled: 1
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,6 +3,7 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.AI;
using System.Text;
public class MapManager : SingletonBehaviour<MapManager>
{
......@@ -23,9 +24,15 @@ public class MapManager : SingletonBehaviour<MapManager>
public Map[] stage;
public BulletFactory bulletFactory;
public TextAsset asd;
public void LoadMap(Map _newMap)
{
if (currentMap != null)
/*if (currentMap != null)
Destroy(currentMap.gameObject);
currentMap = Instantiate(_newMap);
currentMap.transform.position = new Vector3(0, 0, 0);
......@@ -35,7 +42,7 @@ public class MapManager : SingletonBehaviour<MapManager>
for (int i = 0; i < currentMap.startFloors.Count; i++)
PlayerController.inst.CreatePlayer(currentMap.startFloors[i]);
for (int i = 0; i < currentMap.initialBullets.Count; i++)
PlayerController.inst.bulletList.Add(currentMap.initialBullets[i]);
PlayerController.inst.bulletList.Add(currentMap.initialBullets[i]);*/
}
public IEnumerator Rebaker()
{
......
......@@ -2,6 +2,7 @@
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Newtonsoft.Json;
using System.IO;
public class MapEditor : SingletonBehaviour<MapEditor>
......@@ -63,7 +64,6 @@ public class MapEditor : SingletonBehaviour<MapEditor>
}
foreach(Transform child in currentMap.floors.transform)
{
Debug.Log("dD");
Floor temp = child.GetComponent<Floor>();
mapSaveData.Add(new MapSaveData(TileMode.Floor, temp.mapPos));
if (child.GetComponent<Floor>().isGoalFloor)
......@@ -89,13 +89,7 @@ public class MapEditor : SingletonBehaviour<MapEditor>
mapSaveData.Add(new MapSaveData(TileMode.BMannequin, temp.GetPos()));
}
}
List<MapSaveData> a = new List<MapSaveData>();
a.Add(new MapSaveData(TileMode.None, new Vector2(2, 3)));
string mapSaveJson = JsonUtility.ToJson(a);
Debug.Log(mapSaveJson);
File.WriteAllText(localPath, mapSaveJson);
File.WriteAllText(localPath, JsonConvert.SerializeObject(mapSaveData));
Debug.Log("Map saved at " + localPath);}
}
public void SaveCurrentMap()
......
{}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment