/// <summary> /// 自分から出すターゲットラインを更新します /// </summary> private void updateTargetLine() { if (tasks.Count <= 0) { return; } BattleTask task = tasks[0]; if (task.getIsSkill()) { IActiveSkill useSkill = task.getSkill(); if (ActiveSkillSupporter.isAffectSkill(useSkill)) { List <IBattleable> targets = task.getTargets(); drawTargetingLine(player, targets, useSkill.getName(), useSkill.isFriendly()); } } else { List <IBattleable> targets = task.getTargets(); var item = task.getItem(); drawTargetingLine(player, targets, item.getName(), true); } }
private void idleState() { if (tasks.Count > 0) { BattleTask runTask = tasks[0]; if (runTask.getIsSkill()) { delay = runTask.getSkill().getDelay(player); } else { float delayBonus = (float)player.getAbilityContainsBonus(BattleAbility.AGI) / 20; delayBonus = (delayBonus < 1.0f) ? delayBonus : 1.0f; delay = 2.0f - delayBonus; } maxDelay = delay; listView.deleteTask(runTask); state.resetProgress(); updateTargetLine(); runTask.activeteIsProssesing(); this.battleState = BattleState.DELAY; } }
/// <summary> /// moveAreaNodeが選択された時の処理 /// </summary> public void moveAreaChose(int move) { int moveAmount = move; BattleTask addingTask = new BattleTask(player.getUniqueId(), chosenActiveSkill, move, battletaskIdCount); goingPos += move; addTask(addingTask); }
/// <summary> /// ステートがACTIONの時に毎フレーム行う処理 /// </summary> private void actionState() { BattleTask task = creatTask(); task.getSkill().action(user, task); delay = task.getSkill().getDelay(user); state = BattleState.IDLE; }
public override bool Equals(object obj) { if (!(obj is BattleTask)) { return(false); } BattleTask task = (BattleTask)obj; return(task.getOwnerBattleId() == OWNER_UNIQUEID && task.getBattleTaskId() == ID); }
/// <summary> /// taretNodeが選択された時の処理 /// </summary> /// <param name="pos">選択された場所</param> public void targetChose(FieldPosition pos) { if (currentManagerState == ManagerState.ITEM) { throw new NotSupportedException("area extent item hasn't impremented yet"); } BattleTask addingTask = new BattleTask(player.getUniqueId(), chosenActiveSkill, pos, battletaskIdCount); addTask(addingTask); }
/// <summary> /// タスクを追加します /// </summary> /// <param name="addedTask">Add task.</param> private void addTask(BattleTask addedTask) { Debug.Log("added " + addedTask.getName()); tasks.Add(addedTask); listView.setTask(addedTask); battletaskIdCount++; chosenActiveSkill = null; inputActiveSkillList(); }
public void canseledTask(BattleTask task) { if (task.getSkill().getActiveSkillType() == ActiveSkillType.MOVE) { goingPos -= task.getMove(); } if (ActiveSkillSupporter.isAffectSkill(task.getSkill()) && task.getIsProssesing()) { deleteTargetingLine(player); } tasks.Remove(task); }
/// <summary> /// タスクを削除します /// </summary> /// <param name="task"> 削除するタスク </param> public void deleteTask(BattleTask task) { foreach (BattleTaskNode node in nodes) { if (node.getTaskId() == task.getBattleTaskId()) { node.delete(); nodes.Remove(node); break; } } }
/// <summary> /// タスクを追加します /// </summary> /// <param name="task"> 追加するタスク </param> public void setTask(BattleTask task) { GameObject node = Instantiate(nodePrefab); node.transform.SetParent(content.transform); BattleTaskNode nodeContent = node.GetComponent <BattleTaskNode>(); nodeContent.setTaskId(task.getBattleTaskId()); nodeContent.setTask(task); nodeContent.setListAndManager(this, manager); nodes.Add(nodeContent); }
/// <summary> /// taretNodeが選択された時の処理 /// </summary> /// <param name="targets">選択されたターゲットのリスト</param> public void targetChose(List <IBattleable> targets) { BattleTask addingTask; if (currentManagerState == ManagerState.SKILL) { addingTask = new BattleTask(player.getUniqueId(), chosenActiveSkill, targets, battletaskIdCount); } else { addingTask = new BattleTask(player.getUniqueId(), choseItem, targets[0], battletaskIdCount); } addTask(addingTask); }
/// <summary> /// BattleTaskを生成します /// </summary> /// <returns>生成したタスク</returns> private BattleTask creatTask() { if (!isReady) { throw new InvalidOperationException("manager hasn't readied yet"); } IActiveSkill skill = ai.decideSkill(); if (ActiveSkillSupporter.isAffectSkill(skill)) { Extent extent = ActiveSkillSupporter.searchExtent(skill); BattleTask returnTask; //効果範囲に応じてタスクを生成 switch (extent) { case Extent.SINGLE: IBattleable target = ai.decideSingleTarget(skill); List <IBattleable> singleTargetList = new List <IBattleable>() { target }; returnTask = new BattleTask(user.getUniqueId(), skill, singleTargetList, battletaskIdCount); break; case Extent.AREA: FieldPosition pos = ai.decideAreaTarget(skill); returnTask = new BattleTask(user.getUniqueId(), skill, pos, battletaskIdCount); break; case Extent.ALL: List <IBattleable> allTargetList = BattleManager.getInstance().getJoinedBattleCharacter(); returnTask = new BattleTask(user.getUniqueId(), skill, allTargetList, battletaskIdCount); break; default: throw new NotSupportedException("unkonwn extent"); } battletaskIdCount++; return(returnTask); } else if (skill.getActiveSkillType() == ActiveSkillType.MOVE) { MoveSkill moveSkill = (MoveSkill)skill; int move = ai.decideMove(moveSkill); BattleTask returnTask = new BattleTask(user.getUniqueId(), skill, move, battletaskIdCount); battletaskIdCount++; return(returnTask); } throw new InvalidOperationException("unknown skillType"); }
/// <summary> /// ステートがACTIONの時に毎フレーム行う処理 /// </summary> private void actionState() { BattleTask runTask = tasks[0]; Debug.Log("run " + runTask.getName()); if (runTask.getIsSkill()) { IActiveSkill runSkill = runTask.getSkill(); runSkill.action(player, runTask); if (ActiveSkillSupporter.isAffectSkill(runSkill)) { Debug.Log("into isAffect"); deleteTargetingLine(player); } } else { IItem runItem = runTask.getItem(); player.getInventory().useItem(runItem, player); } tasks.Remove(runTask); battleState = BattleState.IDLE; }
/// <summary> /// タスクを削除します /// </summary> /// <param name="task"> 削除したいタスク </param> public void finishedTask(BattleTask task) { tasks.Remove(task); }
/// <summary> /// タスクを設定します /// </summary> /// <param name="task"> 設定するタスク </param> public void setTask(BattleTask task) { this.task = task; name.text = task.getName(); }