Ejemplo n.º 1
0
 private void CompleteNavMeshLink()
 {
     Agent.ActivateCurrentOffMeshLink(true);
     Agent.CompleteOffMeshLink();
     Agent.isStopped             = false;
     Agent.obstacleAvoidanceType = ObstacleAvoidanceType.HighQualityObstacleAvoidance;
 }
Ejemplo n.º 2
0
    private bool HandleNavMeshLinkTraversalStart(float delta)
    {
        OffMeshLinkData currentOffMeshLinkData = Agent.currentOffMeshLinkData;

        if (!currentOffMeshLinkData.valid || !currentOffMeshLinkData.activated)
        {
            return(false);
        }
        Vector3 normalized = (currentOffMeshLinkData.endPos - currentOffMeshLinkData.startPos).normalized;

        normalized.y = 0f;
        Vector3 desiredVelocity = Agent.desiredVelocity;

        desiredVelocity.y = 0f;
        if (Vector3.Dot(desiredVelocity, normalized) < 0.1f)
        {
            CompleteNavMeshLink();
            return(false);
        }
        currentNavMeshLinkName = currentOffMeshLinkData.linkType.ToString();
        Vector3 vector = ((BaseEntity != null) ? BaseEntity.ServerPosition : base.transform.position);

        if ((vector - currentOffMeshLinkData.startPos).sqrMagnitude > (vector - currentOffMeshLinkData.endPos).sqrMagnitude)
        {
            currentNavMeshLinkEndPos = currentOffMeshLinkData.startPos;
        }
        else
        {
            currentNavMeshLinkEndPos = currentOffMeshLinkData.endPos;
        }
        traversingNavMeshLink = true;
        Agent.ActivateCurrentOffMeshLink(false);
        Agent.obstacleAvoidanceType = ObstacleAvoidanceType.NoObstacleAvoidance;
        if (!(currentNavMeshLinkName == "OpenDoorLink") && !(currentNavMeshLinkName == "JumpRockLink"))
        {
            bool flag = currentNavMeshLinkName == "JumpFoundationLink";
        }
        return(true);
    }