当前位置: 首页>>代码示例>>C#>>正文


C# Path.Last方法代码示例

本文整理汇总了C#中Path.Last方法的典型用法代码示例。如果您正苦于以下问题:C# Path.Last方法的具体用法?C# Path.Last怎么用?C# Path.Last使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path的用法示例。


在下文中一共展示了Path.Last方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetPath

        private void SetPath(Path path, bool isWaypoint)
        {
            _endOfResolvedPath = path.Last().position;
            _currentGrid = GridManager.instance.GetGrid(path.Peek().position);

            if (isWaypoint)
            {
                _remainingPathDistance += path.CalculateLength();

                _currentPath = _currentPath.AppendSegment(path);
            }
            else
            {
                if (!TrimPath(path))
                {
                    RequestPath(_transform.position, _wayPoints.desiredEndOfPath, InternalPathRequest.Type.Normal);
                    _currentPath = null;
                    return;
                }

                _currentPath = path;
                _remainingPathDistance = path.CalculateLength();

                //Pop the first node as our next destination.
                _currentDestination = path.Pop();
                _curPlannedDirection = _transform.position.DirToXZ(_currentDestination.position);
            }

            _unit.hasArrivedAtDestination = false;
        }
开发者ID:andrewstarnes,项目名称:wwtd2,代码行数:30,代码来源:SteerForPathComponent.cs

示例2: SetManualPath

        private void SetManualPath(Path path, ReplanCallback onReplan)
        {
            if (path == null || path.count == 0)
            {
                StopInternal();
                return;
            }

            _stop = false;
            _stopped = false;
            _arrivalEvent = UnitNavigationEventMessage.Event.DestinationReached;
            _manualReplan = onReplan;

            int pathCount = path.count - 1;
            for (int i = 0; i < pathCount; i++)
            {
                var node = path[i];
                if (node is Waypoint)
                {
                    _wayPoints.AddWaypoint(node.position);
                }
            }

            _wayPoints.AddWaypoint(path.Last().position, true);

            SetPath(path, false);

            _lastPathRequestTime = Time.time;
        }
开发者ID:andrewstarnes,项目名称:wwtd2,代码行数:29,代码来源:SteerForPathComponent.cs

示例3: SetManualPath

        private void SetManualPath(Path path, ReplanCallback onReplan)
        {
            if (path == null || path.count == 0)
            {
                StopInternal();
                return;
            }

            _stop = false;
            _stopped = false;
            _onFinalApproach = false;
            _manualReplan = onReplan;
            _currentPath = path;
            _endOfResolvedPath = _currentPath.Last().position;
            _currentDestination = path.Pop();
            _currentGrid = GridManager.instance.GetGrid(_currentDestination.position);

            _endOfPath = _endOfResolvedPath;
            _lastPathRequestTime = Time.time;
        }
开发者ID:forwolk,项目名称:UnityApex,代码行数:20,代码来源:SteerForPathComponent.cs

示例4: GetFile

 public IFile GetFile(string filePath)
 {
     var resolvedFilePath = System.IO.Path.GetFullPath(System.IO.Path.Combine(CurrentDirectory, filePath));
     var pathSegments = new Path(resolvedFilePath).Segments;
     var ownerFolder = pathSegments
         .Skip(1).Take(pathSegments.Count()-2)
         .Aggregate((IDirectory)GetRoot(pathSegments.First()),
             (current, segment) => current.GetDirectory(segment));
     return ownerFolder.GetFile(pathSegments.Last());
 }
开发者ID:rvdginste,项目名称:openfilesystem,代码行数:10,代码来源:InMemoryFileSystem.cs

示例5: ConsumeResult

        private bool ConsumeResult()
        {
            //Since result processing may actually repath and consequently a new result may arrive we need to operate on locals and null the pending result
            PathResult result;
            lock (_syncLock)
            {
                result = _pendingResult;
                _pendingResult = null;
            }

            var req = result.originalRequest as InternalPathRequest;

            //Consume way points if appropriate. This must be done prior to the processing of the result, since if the request was a way point request, the first item in line is the one the result concerns.
            if (req.pathType == InternalPathRequest.Type.Waypoint)
            {
                _wayPoints.Dequeue();
            }
            else if (req.pathType == InternalPathRequest.Type.PathboundWaypoint)
            {
                _pathboundWayPoints.Dequeue();
            }

            //Reset current destination and path no matter what
            _previousDestination = _transform.position;
            _currentDestination = null;
            _currentPath = null;

            //Process the result
            if (!ProcessAndValidateResult(result))
            {
                return false;
            }

            //Consume the result
            _onFinalApproach = false;
            _currentPath = result.path;
            _currentGrid = req.fromGrid;
            _remainingSquaredDistance = _currentPath.CalculateSquaredLength();
            _endOfResolvedPath = _currentPath.Last().position;
            _endOfPath = _endOfResolvedPath;

            //Update pending way points
            UpdatePathboundWaypoints(result.pendingWaypoints);

            //Pop the first node as our next destination.
            _unit.hasArrivedAtDestination = false;
            _currentDestination = _currentPath.Pop();
            return true;
        }
开发者ID:forwolk,项目名称:UnityApex,代码行数:49,代码来源:SteerForPathComponent.cs


注:本文中的Path.Last方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。