Commit 0a4852f5 authored by 18김상언's avatar 18김상언

EnemyManager 수정된 것

parent 6418a996
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using System.IO;
using System.Text;
using System;
public class EnemyManager : Singleton<EnemyManager> { public class EnemyManager : Singleton<EnemyManager>
public enum State { {
public enum State
{
Idle, Idle,
Track, Track,
Attack Attack
...@@ -14,7 +19,8 @@ public class EnemyManager : Singleton<EnemyManager> { ...@@ -14,7 +19,8 @@ public class EnemyManager : Singleton<EnemyManager> {
private Dictionary<uint, int[]> dropTableByID; private Dictionary<uint, int[]> dropTableByID;
private Dictionary<uint, List<int[]>> actionDictByID; private Dictionary<uint, List<int[]>> actionDictByID;
protected EnemyManager() { protected EnemyManager()
{
string dropTableDataPath = null; string dropTableDataPath = null;
string actionTableDataPath = null; string actionTableDataPath = null;
...@@ -29,20 +35,26 @@ public class EnemyManager : Singleton<EnemyManager> { ...@@ -29,20 +35,26 @@ public class EnemyManager : Singleton<EnemyManager> {
string tableLine = null; //파일 한 행 string tableLine = null; //파일 한 행
strReader.ReadLine(); //첫 줄 스킵 strReader.ReadLine(); //첫 줄 스킵
while (tableLine = strReader.ReadLine() != null) while ((tableLine = strReader.ReadLine()) != null)
{ {
if (string.IsNullOrEmpty(tableLine)) return; //행이 비었는지 체크 if (string.IsNullOrEmpty(tableLine)) return; //행이 비었는지 체크
cellValue = tableLine.Split(','); cellValue = tableLine.Split(',');
int monsterID = cellValue[0]; //monster가 가진 ID
int itemID = cellValue[2]; //드랍하는 item의 ID uint monsterID = 0;
int dropWeight = cellValue[3]; //드랍할 확률 int itemID = 0, dropWeight = 0;
uint.TryParse(cellValue[0], out monsterID);
int.TryParse(cellValue[2], out itemID);
int.TryParse(cellValue[3], out dropWeight);
int[] itemDrop = new int[] { itemID, dropWeight }; int[] itemDrop = new int[] { itemID, dropWeight };
dropTableByID.Add(monsterID, itemDrop); 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