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

EnemyManager 수정된 것

parent 6418a996
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System.Text;
using System;
public class EnemyManager : Singleton<EnemyManager> {
public enum State {
public class EnemyManager : Singleton<EnemyManager>
{
public enum State
{
Idle,
Track,
Attack
......@@ -14,14 +19,15 @@ public class EnemyManager : Singleton<EnemyManager> {
private Dictionary<uint, int[]> dropTableByID;
private Dictionary<uint, List<int[]>> actionDictByID;
protected EnemyManager() {
protected EnemyManager()
{
string dropTableDataPath = null;
string actionTableDataPath = null;
LoadDropTable(dropTableDataPath);
LoadActionTable(actionTableDataPath);
}
private void LoadDropTable(string dataPath)
{
StreamReader strReader = new StreamReader(dataPath, Encoding.UTF8);
......@@ -29,20 +35,26 @@ public class EnemyManager : Singleton<EnemyManager> {
string tableLine = null; //파일 한 행
strReader.ReadLine(); //첫 줄 스킵
while (tableLine = strReader.ReadLine() != null)
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]; //드랍할 확률
uint monsterID = 0;
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 };
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