public void chooseRandomSkillFromGroup() { //CurrentSkill = SkillGroup[0]; List <SkillFunction> list = new List <SkillFunction>(); for (int i = 0; i < SkillGroup.Length; i++) { SkillFunction skill = SkillGroup[i]; if (skill.isSkillAvailable() && skill.isSkillMeetConditionToAutoRelease()) { list.Add(skill); } } if (list.Count > 0) { CurrentSkill = list[UnityEngine.Random.Range(0, list.Count)]; } else { if (BM == null) { BM = FindObjectOfType <BattleManager>(); } CurrentSkill = BM.normalAttackSkill; } }
public void chooseASkillFromSkillGroup() { CurrentSkill = SkillGroup[0]; for (int i = 0; i < SkillGroup.Length; i++) { SkillFunction skill = SkillGroup[i]; if (skill.isSkillAvailable()) { if (skill.isSkillMeetConditionToAutoRelease()) { CurrentSkill = skill; return; } } } }