using System.Collections; using System.Collections.Generic; using UnityEngine; [System.Serializable] public class CharacterData { public string idx; public int HP; public int ATK = 1; public float DLA_ATK = 0.3f; public float SPD_MOVE = 1; public float MOVE_TIME_SCALE = 1; public int hitMotionSkip = 700; public float knockBack = 3; public float behaviorTime = 1f; public int behaviorChase = 100; public int behaviorEscape = 100; public int behaviorIdle = 100; public CharacterData(string[] spl) { int i = 0; idx = spl[i++]; HP = int.Parse(spl[i++]); ATK = int.Parse(spl[i++]); DLA_ATK = float.Parse(spl[i++]); SPD_MOVE = float.Parse(spl[i++]); MOVE_TIME_SCALE = float.Parse(spl[i++]); hitMotionSkip = int.Parse(spl[i++]); knockBack = float.Parse(spl[i++]); behaviorTime = float.Parse(spl[i++]); behaviorChase = int.Parse(spl[i++]); behaviorEscape = int.Parse(spl[i++]); behaviorIdle = int.Parse(spl[i++]); } } [System.Serializable] public class DataMonster : IData { Dictionary monsters; public List values; public override void TableLoad() { string[] strLine = FileLoadWithLineSplit(path == string.Empty ? "CSV/Monster" : path); string[] spl; monsters = new Dictionary(); for (int i = 1; i < strLine.Length; i++) { if (1 < strLine[i].Length) { spl = strLine[i].Split(','); monsters.Add(spl[0], new CharacterData(spl)); } } values = new List(monsters.Values); } public override void LoadedCheck() { if (monsters == null) TableLoad(); } public CharacterData DataGet(string idx) { TableLoad(); if (monsters.ContainsKey(idx)) return monsters[idx]; return null; } }