} // void _LoadNaviFromTemplate() public bool resetGlobal_constantObjects(CTriCollector triCollector, bool bConstantlyCreateObj) { if (triCollector.m_listTris_naviStart.Count > 0) { foreach (int iTriStart in triCollector.m_listTris_naviStart) { CTRI triStartCurr = triCollector.getTri(iTriStart); if (null != triStartCurr) { m_intervalUnitWalking.newIntervalConstantly(iTriStart, m_processInput._respawnunitwalking, m_processInput._timeinterval_unitwalking, triStartCurr.GetCenterTri()); } } } else { m_intervalUnitWalking.workprocessInterval = false; } m_intervalUnitWalking.workprocessInterval = bConstantlyCreateObj; return(true); }
} // private void SetDrawCellsIndexAll() public void _drawText3D_SeqCells(CTriCollector tricollector, List <int> listCellsIdx) { if (null == m_drawText3DStartCell || listCellsIdx.Count < 1) { return; } m_drawText3DStartCell.clear3DTextAll(); if (listCellsIdx.Count > 0) { Quaternion quaternionCoreText3D = new Quaternion(); Vector3 v3Position; int iSequencialNumber = 0; foreach (int iIdxTri in listCellsIdx) { if (iIdxTri < 0) { continue; } v3Position = tricollector.getTri(iIdxTri).GetCenterTri(); v3Position = v3Position + m_v3PosAdjustText3D; m_drawText3DStartCell.setNew3DText(v3Position, quaternionCoreText3D, m_iFontSizeText3D, m_colorText3D, "" + (iSequencialNumber++) + "(" + iIdxTri + ")", true); } // for (int iSeqBase = 0; iSeqBase < listBase.Count; ++iSeqBase) } } // private void _drawText3D_SeqCells()
Vector3 GetStartTriangleRandomPosition(CTriCollector tricollector, int idxTriangle) { CTRI tri = tricollector.getTri(idxTriangle); float r1 = Random.Range(0.1f, 0.8f); float r2 = Random.Range(0.1f, (1.0f - r1 - 0.1f)); float r3 = 1.0f - r1 - r2; float positionX = tri._arrv3PT[0].x * r1 + tri._arrv3PT[1].x * r2 + tri._arrv3PT[2].x * r3; float positionZ = tri._arrv3PT[0].z * r1 + tri._arrv3PT[1].z * r2 + tri._arrv3PT[2].z * r3; return(new Vector3(positionX, tri._arrv3PT[0].y, positionZ)); }
//@ Collect All BaseTower List which calculated Perfect Square. static public bool CollectAll_perfectSqre_exceptGoalTri(CNAVICELL[] arrNavicells, CTriCollector tricollector, ref List <CBASE__> listBase) { int iCntNaviCell = arrNavicells.Length; if (iCntNaviCell < 1) { Debug.Log("if(iCntNaviCell < 1)"); return(false); } List <int> listIdxTrisGoal = tricollector.m_listTris_naviGoal; List <int> listIdxTrisStart = tricollector.m_listTris_naviStart; List <int> listTriIR = new List <int>(); CNAVICELL.CADJ_TRI[] arrAdjs_ = tricollector.arrayAllTriAdjacent; tricollector.collectAll_IsoscellesRightTriangles(ref listTriIR); List <int> listTri_Instant__ = new List <int>(); bool bValidatedBase_perfectSquare = false; foreach (int iIdxTri in listTriIR) { CNAVICELL.CADJ_TRI adjTri = arrAdjs_[iIdxTri]; CTRI triCurr = tricollector.getTri(iIdxTri); bValidatedBase_perfectSquare = false; //@ process skip if (true == triCurr.inclinedPlane()) { continue; } if (-1 < listIdxTrisGoal.BinarySearch(iIdxTri)) { continue; } if (-1 < listIdxTrisStart.BinarySearch(iIdxTri)) { continue; } int iEdge_Hyptenuse = triCurr.GetHypotenuseEdge(); if (CTRI.NULL_TRI_EDGE == iEdge_Hyptenuse) { continue; } int iTri_Hypotenuse = adjTri._arrTrisAdjacent[iEdge_Hyptenuse]; if (iTri_Hypotenuse == CNAVICELL.NULL_CELL) { continue; } CTRI triHyptenuse = tricollector.getTri(iTri_Hypotenuse); if (triHyptenuse.IsisoscelesRightAngle() == true) { bValidatedBase_perfectSquare = true; listTri_Instant__.Add(iIdxTri); listTri_Instant__.Add(iTri_Hypotenuse); } if (true == bValidatedBase_perfectSquare) { CBASE__ base__New = new CBASE__(); for (int iTri_ = 0; iTri_ < listTri_Instant__.Count; ++iTri_) { int iSeqTri_ = listTri_Instant__[iTri_]; CTRI triPicked = tricollector.getTri(iSeqTri_); base__New.InsertNewTri(iSeqTri_, triPicked, false); } bool bAlreadyExisted = false; foreach (CBASE__ base__Sub in listBase) { if (true == base__Sub.IsSimilar(base__New)) { bAlreadyExisted = true; break; } } if (false == bAlreadyExisted) { base__New.CalculateBase__(iIdxTri); listBase.Add(base__New); } listTri_Instant__.Clear(); } // if(true==bValidatedBase_perfectSquare) } // foreach(int iIdxTri in listTriIR) return(true); } // static public bool CollectAll_perfectSqre_exceptGoalTri()
//@ Debug Draw for Tri Eachtype public void drawAllTri_eachFunctional(CTriCollector triCollector, bool bRepresentBlocks) { if (null == m_drawRenderMesh_triCollector) { return; } undrawAllTri(); List <int> listTrisPicked_naviGoal = triCollector.m_listTris_naviGoal; List <int> listTrisPicked_naviBlock = triCollector.m_listTris_naviBlock; List <int> listTrisPicked_naviBlockRoad = triCollector.m_listTris_naviBlockRoad; List <int> listTrisPicked_naviStart = triCollector.m_listTris_naviStart; // Blocks if (true == bRepresentBlocks) { if (listTrisPicked_naviBlock.Count > 0) { foreach (int iIdxTri in listTrisPicked_naviBlock) { CTRI triRenderDebug = triCollector.getTri(iIdxTri); m_drawRenderMesh_triCollector.DrawNewRendermesh(DFLT_IDX_RENDERTRI_TYPE + iIdxTri, triRenderDebug._arrv3PT, Color.Lerp(Color.blue, Color.black, 0.5f), CMATH.FEPSILON_F2 * 3.0f, CDrawRenderMesh.scaleadjust_render_095); } } // BlockRoads if (listTrisPicked_naviBlockRoad.Count > 0) { foreach (int iIdxTri in listTrisPicked_naviBlockRoad) { CTRI triRenderDebug = triCollector.getTri(iIdxTri); m_drawRenderMesh_triCollector.DrawNewRendermesh(DFLT_IDX_RENDERTRI_TYPE + iIdxTri, triRenderDebug._arrv3PT, Color.Lerp(Color.blue, Color.white, 0.2f), CMATH.FEPSILON_F2 * 3.0f, CDrawRenderMesh.scaleadjust_render_095); } } } // if (true == bRepresentBlocks) // Goals if (listTrisPicked_naviGoal.Count > 0) { foreach (int iIdxTri in listTrisPicked_naviGoal) { CTRI triRenderDebug = triCollector.getTri(iIdxTri); m_drawRenderMesh_triCollector.DrawNewRendermesh(DFLT_IDX_RENDERTRI_TYPE + iIdxTri, triRenderDebug._arrv3PT, Color.red, CMATH.FEPSILON_F2 * 3.0f, CDrawRenderMesh.scaleadjust_render_093); } } // Starts if (listTrisPicked_naviStart.Count > 0) { foreach (int iIdxTri in listTrisPicked_naviStart) { CTRI triRenderDebug = triCollector.getTri(iIdxTri); m_drawRenderMesh_triCollector.DrawNewRendermesh(DFLT_IDX_RENDERTRI_TYPE + iIdxTri, triRenderDebug._arrv3PT, Color.yellow, CMATH.FEPSILON_F2 * 3.0f, CDrawRenderMesh.scaleadjust_render_093); } } } // public void drawAllTri_eachFunctional()