/// 命令:攻撃のセット /** * ATB[0] : 攻撃タイプ * ATB[1] : 攻撃対象との有効角度R * ATB[2] : 攻撃対象との有効角度L * ATB[3] : 攻撃対象との有効距離 **/ private void cmdActSetAttack(int cmdIdx) { int attackType = usePlayAct.GetAtb(cmdIdx, 0); float trgRotR = (float)usePlayAct.GetAtb(cmdIdx, 1); float trgRotL = (float)usePlayAct.GetAtb(cmdIdx, 2); float trgDis = (float)usePlayAct.GetAtb(cmdIdx, 3) / 100.0f;; GameActorContainer interfereCntr = useUnitCmn.GetInterfereCntr(); GameActorProduct trgActor = useUnitCmn.GetUseActor(); /// 攻撃イベントを通達 for (int i = 0; i < interfereCntr.Num; i++) { if (interfereCntr.GetActor(i).EventCntr != null) { if (attackAreaCheck(trgActor, interfereCntr.GetActor(i), trgRotR, trgRotL, trgDis)) { interfereCntr.GetActor(i).EventCntr.Add(ActorEventId.Damage, attackType, trgActor.GetUseObj(0)); } } } }
/// 命令:近くの対象の方向を振り向く /** * ATB[0] : 旋回する対象との有効距離 * ATB[1] : 旋回速度 **/ private void cmdActSetTurnNearTrg(int cmdIdx) { float trgDis = (float)usePlayAct.GetAtb(cmdIdx, 0) / 100.0f; int rotVal = usePlayAct.GetAtb(cmdIdx, 1); GameActorContainer interfereCntr = useUnitCmn.GetInterfereCntr(); GameActorProduct trgActor = useUnitCmn.GetUseActor(); int bestTrg; float dis, disMax; bool entryFlg; bestTrg = -1; disMax = 0.0f; entryFlg = false; for (int i = 0; i < interfereCntr.Num; i++) { if (interfereCntr.GetActor(i).EventCntr != null) { dis = Common.VectorUtil.Distance(trgActor.BasePos, interfereCntr.GetActor(i).BasePos); if (dis <= trgDis && (entryFlg == false || dis < disMax)) { bestTrg = i; disMax = dis; entryFlg = true; } } } /// 一番近くの対象の方向へ振り向く if (bestTrg >= 0) { trgActor.EventCntr.Add(ActorEventId.TurnTrg, rotVal, interfereCntr.GetActor(bestTrg).GetUseObj(0)); } }