コード例 #1
0
    private void OnPathRequestSucceeded(IPathRequestQuery request)
    {
        Vector3[] roughPath    = request.GetSolutionPath(m_pathAgent.PathManager.PathTerrain);
        Vector3[] steeringPath = roughPath;

        if (m_usePathSmoothing)
        {
            // Smooth the path
            Vector3[] aLeftPortalEndPts;
            Vector3[] aRightPortalEndPts;
            m_pathAgent.PathManager.PathTerrain.ComputePortalsForPathSmoothing(roughPath, out aLeftPortalEndPts, out aRightPortalEndPts);
            steeringPath = PathSmoother.Smooth(roughPath, request.GetStartPos(), request.GetGoalPos(), aLeftPortalEndPts, aRightPortalEndPts);
        }

        if (sFinded != null)
        {
            sFinded(steeringPath);
        }

        if (m_pathGroup != null)
        {
//			Debug.Log("steeringPath=" + steeringPath.Length);
            m_pathGroup.SetPath(steeringPath, false);
            StartCoroutine(DelayDestory());
        }
        else
        {
            // Begin steering along this path
            m_steeringAgent.SteerAlongPath(steeringPath, m_pathAgent.PathManager.PathTerrain);
        }
    }
コード例 #2
0
    private void OnPathRequestSucceeded(IPathRequestQuery request)
    {
        Vector3[] roughPath    = request.GetSolutionPath(m_pathAgent.PathManager.PathTerrain);
        Vector3[] steeringPath = roughPath;

        if (m_usePathSmoothing)
        {
            // Smooth the path
            Vector3[] aLeftPortalEndPts;
            Vector3[] aRightPortalEndPts;
            m_pathAgent.PathManager.PathTerrain.ComputePortalsForPathSmoothing(roughPath, out aLeftPortalEndPts, out aRightPortalEndPts);
            steeringPath = PathSmoother.Smooth(roughPath, request.GetStartPos(), request.GetGoalPos(), aLeftPortalEndPts, aRightPortalEndPts);
        }

        // Begin steering along this path
        m_steeringAgent.SteerAlongPath(steeringPath, m_pathAgent.PathManager.PathTerrain);
    }