void Start() { List <Enemy_Info> EnemyList = new List <Enemy_Info>(); Enemy_Info Enemy = new Enemy_Info(); Enemy.Name = "Stage1_Enemy1"; Enemy.AttackSpeed = 0; Enemy.MoveSpeed = 0.5f; Enemy.Damage = 5; Enemy.Hp = 100; EnemyList.Add(Enemy); Enemy = new Enemy_Info(); Enemy.Name = "Stage1_Enemy2"; Enemy.AttackSpeed = 0; Enemy.MoveSpeed = 0.8f; Enemy.Damage = 5; Enemy.Hp = 100; EnemyList.Add(Enemy); Enemy = new Enemy_Info(); Enemy.Name = "Stage1_Enemy3"; Enemy.AttackSpeed = 0; Enemy.MoveSpeed = 1; Enemy.Damage = 5; Enemy.Hp = 100; EnemyList.Add(Enemy); Enemy = new Enemy_Info(); Enemy.Name = "Stage2_Bazuka"; Enemy.AttackSpeed = 0; Enemy.MoveSpeed = 1.5f; Enemy.Damage = 10; Enemy.Hp = 100; EnemyList.Add(Enemy); Enemy = new Enemy_Info(); Enemy.Name = "Stage2_Rifle"; Enemy.AttackSpeed = 0; Enemy.MoveSpeed = 1; Enemy.Damage = 5; Enemy.Hp = 100; EnemyList.Add(Enemy); Enemy = new Enemy_Info(); Enemy.Name = "Stage2_Shield"; Enemy.AttackSpeed = 0; Enemy.MoveSpeed = 0.8f; Enemy.Damage = 5; Enemy.Hp = 150; EnemyList.Add(Enemy); Enemy_Info_IO.Write(EnemyList, Application.dataPath + "/XML/Enemy_Info.xml"); }
void Awake() { Enemy_Info Enemy = Xml_Load.Select_Info("Stage1_Enemy2"); fMaxHp = Enemy.Hp; fCurrentHp = fMaxHp; fMoveSpeed = Enemy.MoveSpeed; fDamage = Enemy.Damage; animator = this.GetComponent <Animator>(); transform = this.GetComponent <Transform>(); sRenderer = this.GetComponent <SpriteRenderer>(); Attack_S = transform.GetChild(0).GetComponent <AudioSource>(); Hit_S = transform.GetChild(1).GetComponent <AudioSource>(); Dead_S = transform.GetChild(2).GetComponent <AudioSource>(); }
public static Enemy_Info Select_Info(string Enemy_Name) { List <Enemy_Info> EnemyList = Enemy_Info_IO.Read(Application.dataPath + "/XML/Enemy_Info.xml"); Enemy_Info Enemy = null; for (int i = 0; i < EnemyList.Count; ++i) { Enemy = EnemyList[i]; if (Enemy.Name == Enemy_Name) { return(Enemy); } else { Enemy = null; } } return(Enemy); }
public static List <Enemy_Info> Read(string filePath) { XmlDocument Document = new XmlDocument(); Document.Load(filePath); XmlElement EnemyListElement = Document["EnemyList"]; List <Enemy_Info> EnemyList = new List <Enemy_Info>(); foreach (XmlElement EnemyElement in EnemyListElement.ChildNodes) { Enemy_Info Enemy = new Enemy_Info(); Enemy.Name = EnemyElement.GetAttribute("Name"); Enemy.AttackSpeed = System.Convert.ToSingle(EnemyElement.GetAttribute("AttackSpeed")); Enemy.MoveSpeed = System.Convert.ToSingle(EnemyElement.GetAttribute("MoveSpeed")); Enemy.Damage = System.Convert.ToSingle(EnemyElement.GetAttribute("Damage")); Enemy.Hp = System.Convert.ToSingle(EnemyElement.GetAttribute("Hp")); EnemyList.Add(Enemy); } return(EnemyList); }