Ejemplo n.º 1
0
        public void FollowPath(AimAStarPath path)
        {
            if (path == null || path.PathPoints.Count == 0)
            {
                return;
            }

            if (m_currentNodeIndex >= path.PathPoints.Count)
            {
                m_currentNodeIndex = path.PathPoints.Count - 1;
            }

            if (m_currentNodeIndex == -1)
            {
                m_currentNodeIndex = 0;
            }

            vec3 targetPoint = path.PathPoints[m_currentNodeIndex];

            if (glm.length(targetPoint - transform.position) <= 1)
            {
                m_currentNodeIndex++;
            }

            Seek(targetPoint);
        }
Ejemplo n.º 2
0
        public AimTaskStatus GetPathToDust()
        {
            m_agent.ResetAgentState();
            m_dustPath = AimAStar.AimAStarEvaluate(new vec3(gameObject.transform.position), m_dustPosition, m_aimNavMesh);

            if (m_dustPath == null || m_dustPath.LastPoint == null)
            {
                GenerateDustPosition();
                return(AimTaskStatus.Failure);
            }

            m_dustPathGenerated.Condition = true;

            return(AimTaskStatus.Success);
        }