public void ExecuteCommand(Command command) { var message = ""; Unit fromUnit = command.FromUnit; Unit toUnit = command.ToUnit; string fromUnitName = fromUnit.Name; //対象をとらないときどうするか //string toUnitName = toUnit.GetName(); //混乱時、対象をランダムにする //行動できる状態か、状態異常の確認 //死んでいたらスキップ if (!fromUnit.IsDeath) { //攻撃対象が死亡していたら、生きている相手の中から選びなおす if (toUnit != null && toUnit.IsDeath) { //if (command.Ability.Target == Target.ally && fromUnit.GetType() == typeof(Ally)) //{ //} toUnit = fromUnit.ChooseOpponentRandomly(units); //toUnitName = toUnit.GetName(); } if (command.Ability.GetType() == typeof(Skill)) { Skill skill = command.Ability as Skill; //状態異常により、コマンドがキャンセルされた場合 //if (skill.SkillType == SkillType.物理攻撃 || skill.SkillType == SkillType.物理補助 && // fromUnit.Ailments.ContainsKey(Ailment.curse)) //{ // Skill ailmentSkill = skillGenerator.GenerateAilmentSkill(Ailment.curse); // message += gameController.SkillEffector.Use(ailmentSkill, units, fromUnit, toUnit); //} //else if (skill.SkillType == SkillType.魔法攻撃 || skill.SkillType == SkillType.魔法補助 && // fromUnit.Ailments.ContainsKey(Ailment.seal)) //{ // Skill ailmentSkill = skillGenerator.GenerateAilmentSkill(Ailment.seal); // message += gameController.SkillEffector.Use(ailmentSkill, units, fromUnit, toUnit); //} string ailmentMessage = CheckAilment(fromUnit, skill); if (!string.IsNullOrEmpty(ailmentMessage)) { message += gameController.SkillEffector.Use(skill, units, fromUnit, toUnit); } else { message += ailmentMessage; } } else if (command.Ability.GetType() == typeof(Item)) { //List<Item> items = allyManager.GetItems(); Item item = command.Ability as Item; message += gameController.ItemEffecor.Use(item, units, fromUnit, toUnit); } //パネルの表示を更新 messageManager.AddText(message); allyManager.UpdatePanels(); enemyManager.UpdateEnemyPanel(); } else { isWaitingClick = false; } //戦闘終了の確認 //CheckDone(); if (allyManager.CheckAllDead()) { messageManager.AddText("冒険者たちは全滅した"); isDone = true; } //敵が全滅 else if (enemyManager.CheckAllDead()) { StartCoroutine(OnClickInEndOfBattle()); } else { StartCoroutine(Click()); } }