} // public bool getPosWayToGoal(int iSeqCell_current, ref CCellWayto pntNavi_out) //@ -Return:pre-calculated shortest cost middle edge position (way to goal) (when mappingnavigation). // Every navicell have just only one shortest way to GOAL. public CNAVICELL.E_CELL_STATUS getPosNextWayTo(int iSeqCell_current, ref CCellWayto pntNavi_out) { if (iSeqCell_current > (int)m_arrNavicells.Length || iSeqCell_current < 0) { Debug.Log("!!!ERROR iSeqCell_current>(int)m_arrNavicells.size()||iSeqCell_current<0"); return(CNAVICELL.E_CELL_STATUS.CELL_STATUS_NULL); } CNAVICELL naviCellcurr = m_arrNavicells[iSeqCell_current]; Vector3 v3PosDest = new Vector3(); Vector3 v3PosStart = new Vector3(); naviCellcurr.getPos_nextWay(ref v3PosStart); int iIdxCellCurrent = naviCellcurr.seqCell; int iIdxCellNextTo = naviCellcurr.getIdxCell_nextWay(); if (CNAVICELL.NULL_CELL == iIdxCellNextTo) { return(CNAVICELL.E_CELL_STATUS.CELL_STATUS_NULL); } CNAVICELL naviCellNext = m_arrNavicells[iIdxCellNextTo]; if (naviCellNext.IsGoalCell()) { return(CNAVICELL.E_CELL_STATUS.CELL_STATUS_GOAL); } bool bGetPos_nextWay = naviCellNext.getPos_nextWay(ref v3PosDest); if (false == bGetPos_nextWay) { return(CNAVICELL.E_CELL_STATUS.CELL_STATUS_NULL); } Vector3 posEdgeTo0 = new Vector3(), posEdgeTo1 = new Vector3(), posEdgeFrom0 = new Vector3(), posEdgeFrom1 = new Vector3(); naviCellcurr.getPntsOfEdgeBestway(ref posEdgeFrom0, ref posEdgeFrom1); naviCellNext.getPntsOfEdgeBestway(ref posEdgeTo0, ref posEdgeTo1); Vector3 v3dirEntryToNextway = naviCellNext.getDirEntryToGoal(iIdxCellCurrent); pntNavi_out.setPntnavi(iIdxCellNextTo, naviCellcurr.leveltogoal, v3PosStart, v3PosDest, posEdgeFrom0, posEdgeFrom1, posEdgeTo0, posEdgeTo1, naviCellNext.getPos_cellCenter(), v3dirEntryToNextway); return(CNAVICELL.E_CELL_STATUS.CELL_STATUS_ROAD); } // public bool getPosWayToGoal(int iSeqCell_current, ref CCellWayto pntNavi_out)
public void setPntnavi(CCellWayto otherpnt) { _idxnavicell = otherpnt._idxnavicell; _ileveltoGoal = otherpnt._ileveltoGoal; _posStart = otherpnt._posStart; _postoDest = otherpnt._postoDest; _posEdgeFrom0 = otherpnt._posEdgeFrom0; _posEdgeFrom1 = otherpnt._posEdgeFrom1; _posEdgeTo0 = otherpnt._posEdgeTo0; _posEdgeTo1 = otherpnt._posEdgeTo1; _posCenterCell = otherpnt._posCenterCell; _dirEntrytoNext = otherpnt._dirEntrytoNext; }
//@ -Return:pre-calculated shortest cost middle edge position (way to goal) (when mappingnavigation). // Every navicell have just only one shortest way to GOAL. public CNAVICELL.E_CELL_STATUS getPosCurrentWayToGoal(int iSeqCell_current, ref CCellWayto pntNavi_out) { if (iSeqCell_current > (int)m_arrNavicells.Length || iSeqCell_current < 0) { Debug.Log("!!!ERROR iSeqCell_current>(int)m_arrNavicells.size()||iSeqCell_current<0"); return(CNAVICELL.E_CELL_STATUS.CELL_STATUS_NULL); } CNAVICELL naviCell = m_arrNavicells[iSeqCell_current]; Vector3 v3PosDest = Vector3.zero; bool bGetPos_nextWay = naviCell.getPos_nextWay(ref v3PosDest); if (false == bGetPos_nextWay || Vector3.zero == v3PosDest) { return(CNAVICELL.E_CELL_STATUS.CELL_STATUS_NULL); } Vector3 posEdge0 = new Vector3(), posEdge1 = new Vector3(); naviCell.getPntsOfEdgeBestway(ref posEdge0, ref posEdge1); pntNavi_out.setPntnavi(naviCell.seqCell, naviCell.leveltogoal, Vector3.zero, v3PosDest, posEdge0, posEdge1, posEdge0, posEdge1, naviCell.getPos_cellCenter(), naviCell.dirCenterToGoal); return(CNAVICELL.E_CELL_STATUS.CELL_STATUS_ROAD); } // public bool getPosWayToGoal(int iSeqCell_current, ref CCellWayto pntNavi_out)
public CCellWayto(CCellWayto otherpnt) { setPntnavi(otherpnt); }
} // public bool getPosWayToGoal(int iSeqCell_current, ref CCellWayto pntNavi_out) //@ -Return: public bool getPosWayTo_Portal(int iSeqCell_current, Vector2[] arrv2PntObjBoundary, ref CCellWayto pntNavi_out) { if (iSeqCell_current > (int)m_arrNavicells.Length || iSeqCell_current < 0) { Debug.Log("iSeqCell_current>(int)m_arrNavicells.size()||iSeqCell_current<0"); return(false); } CNAVICELL naviCellCurr = m_arrNavicells[iSeqCell_current]; //@ 가시성을 고려한 최단 거리의 위치값 설정. Vector3 v3PosDest = new Vector3(); bool bGetPos_nextWay = setNaviPortal_forShortestWay(arrv2PntObjBoundary, ref naviCellCurr); if (false == bGetPos_nextWay) { return(false); } pntNavi_out._idxnavicell = naviCellCurr.seqCell; pntNavi_out._postoDest = v3PosDest; return(true); }