Commit 6418a996 authored by 18김상언's avatar 18김상언

EnemyManager의 LoadDropTable() 코드 작성함

민규 킴의 다음 지시를 머기하겠음
parent eb02ff1b
...@@ -11,7 +11,7 @@ public class EnemyManager : Singleton<EnemyManager> { ...@@ -11,7 +11,7 @@ public class EnemyManager : Singleton<EnemyManager> {
public delegate void Action<T>(); public delegate void Action<T>();
private Dictionary<uint, List<int[]>> dropTableByID; private Dictionary<uint, int[]> dropTableByID;
private Dictionary<uint, List<int[]>> actionDictByID; private Dictionary<uint, List<int[]>> actionDictByID;
protected EnemyManager() { protected EnemyManager() {
...@@ -21,9 +21,27 @@ public class EnemyManager : Singleton<EnemyManager> { ...@@ -21,9 +21,27 @@ public class EnemyManager : Singleton<EnemyManager> {
LoadDropTable(dropTableDataPath); LoadDropTable(dropTableDataPath);
LoadActionTable(actionTableDataPath); LoadActionTable(actionTableDataPath);
} }
private void LoadDropTable(string dataPath) {
private void LoadDropTable(string dataPath)
{
StreamReader strReader = new StreamReader(dataPath, Encoding.UTF8);
string[] cellValue = null; //csv파일 한 행에 포함되는 칸들의 값 넣을 배열
string tableLine = null; //파일 한 행
strReader.ReadLine(); //첫 줄 스킵
while (tableLine = strReader.ReadLine() != null)
{
if (string.IsNullOrEmpty(tableLine)) return; //행이 비었는지 체크
cellValue = tableLine.Split(',');
int monsterID = cellValue[0]; //monster가 가진 ID
int itemID = cellValue[2]; //드랍하는 item의 ID
int dropWeight = cellValue[3]; //드랍할 확률
int[] itemDrop = new int[] { itemID, dropWeight };
dropTableByID.Add(monsterID, itemDrop);
}
} }
private void LoadActionTable(string dataPath) { private void LoadActionTable(string dataPath) {
} }
......
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