Exemple #1
0
        public int[] GetObstructedCells(out int numObstructedCells)
        {
            numObstructedCells = 0;

            // Determine which cells are actually obstructed
            for (int rowCount = 0; rowCount < m_numObstructedCellPoolRows; rowCount++)
            {
                float currentVertLength = rowCount * GameDefine.CellSize;

                for (int colCount = 0; colCount < m_numObstructedCellPoolColumns; colCount++)
                {
                    float   currentHorizLength = colCount * GameDefine.CellSize;
                    Vector3 testPos            = lowerLeftPos + horizDir * currentHorizLength + vertDir * currentVertLength;
                    testPos.x = Mathf.Clamp(testPos.x, m_bounds.min.x, m_bounds.max.x);
                    testPos.z = Mathf.Clamp(testPos.z, m_bounds.min.z, m_bounds.max.z);
                    if (NavigationMgr.GetInstance().GetGrid().IsInBounds(testPos))
                    {
                        int obstructedCellIndex = NavigationMgr.GetInstance().GetGrid().GetCellIndex(testPos);
                        m_obstructedCellPool[numObstructedCells] = obstructedCellIndex;
                        numObstructedCells++;
                    }

                    if (currentHorizLength > horizLength)
                    {
                        break;
                    }
                }

                if (currentVertLength > vertLength)
                {
                    break;
                }
            }

            return(m_obstructedCellPool);
        }
Exemple #2
0
 public Vector3 GetPathAgentFootPos()
 {
     return(NavigationMgr.GetInstance().GetGrid().GetValidPathFloorPos(GetPositon()));
 }