void makeBattleAction() { int[] from = new int[1]; from[0] = currentPlayerIndex; BattleActionData data = makeBattleActionData(from, targetIndices); setCharacterAction(currentPlayerIndex, data); }
void SetEnemyActionData() { for (int i = 0; i < enemyPartyData.Length; i++) { int[] from = new int[1]; from[0] = i + 5; int[] to = new int[1]; to[0] = targetPicker(false); BattleActionData data = makeBattleActionData(from, to); battleActionQueue.Add(data); } }
void setAllBaseActions() { resetActionData(); for (int i = 0; i < 5; i++) { int[] from = new int[1]; from[0] = i; BattleActionData data = makeBattleActionData(from, targetIndices); setCharacterAction(i, data); uiController.SetActionText(i, "Attack"); } }
void setCharacterAction(int charIndex, BattleActionData action) { characterBattleData[charIndex] = action; }
BattleActionData makeBattleActionData(int[] fromIndex, int[] toIndex) { GameCharacter[] from = new GameCharacter[fromIndex.Length]; int priorityCount = 0; for (int i = 0; i < fromIndex.Length; i++) { if (fromIndex[i] < 5) { from[i] = userPartyData[fromIndex[i]]; } else { int targetIndex = fromIndex[i] - 5; from[i] = enemyPartyData[targetIndex]; } priorityCount += from[i].CurrentStat.AGI; } priorityCount /= fromIndex.Length; GameCharacter[] to = new GameCharacter[toIndex.Length]; for (int i = 0; i < toIndex.Length; i++) { if (toIndex[i] < 5) { to[i] = userPartyData[toIndex[i]]; } else { int targetIndex = toIndex[i] - 5; to[i] = enemyPartyData[targetIndex]; } } BattleAction btAction; switch (currentAction) { case BtAction.Attack: btAction = AttackAction; break; case BtAction.Skill: btAction = SkillAction; break; case BtAction.Item: btAction = ItemAction; break; case BtAction.Formation: btAction = AttackAction; break; case BtAction.Run: btAction = RunAction; break; default: btAction = AttackAction; break; } BattleActionData data = new BattleActionData(btAction, from, fromIndex, to, toIndex, curActionIndex, 1, priorityCount); return(data); }