//敵のコマンドを作成します //コマンドリストからランダムに一つ選びバトルコマンドに変換して登録します private BattleCommand CreateEnemyCommand(EnemyCharacter enemy) { List <Command> enemyCommands = enemy.GetCommands(); Command randomChoiceCommand = enemyCommands.ElementAt(Random.Range(0, enemyCommands.Count)); EnemyCharacter owner = enemy; TargetFilter targetFilter = new TargetFilter(); List <BattleCharacter> target = null; switch (randomChoiceCommand) { case Spell spellData: target = targetFilter.EnemyToFilter(owner, spellData.targetUnit, spellData.targetRange); return(new SpellCommand(spellData, owner, target)); case Skill skillData: target = targetFilter.EnemyToFilter(owner, skillData.targetUnit, skillData.targetRange); return(new SkillCommand(skillData, owner, target)); default: break; } throw new System.Exception("Enemyの行動を作成できませんでした"); }