//@ Process public override void InitUnitMovement() { setSplineGuide(seqSplineGuide, ref m_arrLineGuide); if (null == m_arrLineGuide) { Debug.Log("Error(critical). UnitFlying got no spline guide."); return; } CSplineManufacturer.curvesection pos_pathFirst = m_arrLineGuide[default_section_start]; //@ TM 설정 positionUnit = pos_pathFirst._posSectionStart; forwardforAngle = forwardforMovement = pos_pathFirst._dirtoNextP; velocityAngleStandard = default_velocityAngle_unitflying_rad; if (true == processCycle.GetInstance._modeTool) { speedmove = processCycle.GetInstance.m_speedmove_unitflying; } else { speedmove = m_UnitTemplate.m_MoveSpeed; } setSectionSP(default_section_start); }
protected int getSectionNextAdjust(int iSectionCurrent, Vector3 posCurrent, Vector3 posNextestimate, CSplineManufacturer.curvesection[] arrpossection, ref Vector3 posnextCalculated) { int iSectionLast = arrpossection.Length - 1; int iSectionnew = iSectionCurrent, iSectionCurr = iSectionCurrent; if (iSectionLast <= iSectionCurr) { posnextCalculated = posNextestimate; return iSectionLast; } Vector3 posnextestIter = posNextestimate; bool bAdjustment = false; float distCrossover = 0.0f; for (int iSec = iSectionCurr; iSec <= iSectionLast; ++iSec) { CSplineManufacturer.curvesection curveSec = arrpossection[iSec]; if (true == curveSec.crossoverCurr(posnextestIter)) { if (iSectionLast == iSec) { iSectionnew = iSec; break; } CSplineManufacturer.curvesection curveSecNext = arrpossection[iSec + 1]; distCrossover = (posnextestIter - curveSec._posSectionDest).magnitude; posnextestIter = curveSecNext._posSectionStart + (curveSecNext._dirtoNextP * distCrossover); bAdjustment = true; } else { iSectionnew = iSec; break; } } if (true == bAdjustment) { forwardforAngleTarget = forwardforMovement = m_arrLineGuide[iSectionnew]._dirtoNextP; } posnextCalculated = posnextestIter; return iSectionnew; }