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


C# SharpDX.Distance方法代码示例

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


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

示例1: MoveToPosWithNavMeshAsync

        public static async Task<bool> MoveToPosWithNavMeshAsync(SharpDX.Vector3 vecDest, int NearDistance = 50)
        {
            if (Nav.D3.Navmesh.Current == null)
                Nav.D3.Navmesh.Create(Enigma.D3.Engine.Current, new Nav.ExploreEngine.Nearest());

            var localAcd = ActorCommonDataHelper.GetLocalAcd();
            var distance = vecDest.Distance(); // (Math.Pow(localAcd.x0D0_WorldPosX - vecDest.X, 2) + Math.Pow(localAcd.x0D4_WorldPosY - vecDest.Y, 2));

            var minDistanceReached = distance;
            var dtDistanceReached = DateTime.Now;

            DateTime dtTimeout = DateTime.Now;
            while (distance > NearDistance)
            {
                if (DateTime.Now > dtTimeout.AddSeconds(30) || DateTime.Now > dtDistanceReached.AddSeconds(10))
                    return false;

                SharpDX.Vector2 curVector = localAcd.ToSharpDXVector2(); // new SharpDX.Vector2(localAcd.x0D0_WorldPosX, localAcd.x0D4_WorldPosY);
                SharpDX.Vector2 destVector = new SharpDX.Vector2(vecDest.X, vecDest.Y);

                // Update current player position.
                Nav.D3.Navmesh.Current.Navigator.CurrentPos = localAcd.ToNavVec3(); // new Nav.Vec3(localAcd.x0D0_WorldPosX, localAcd.x0D4_WorldPosY, localAcd.x0D8_WorldPosZ);

                // Update destination. You can keep setting the same value there is internal check if destination has actually changed. 
                // This destination overrides any internal destinations (including exploration). When You just want to explore You do 
                // not need to set any destination. It will be set automatically.
                Nav.D3.Navmesh.Current.Navigator.Destination = new Nav.Vec3(vecDest.X, vecDest.Y, vecDest.Z);

                // Get current destination.
                Nav.Vec3 goToPosition = Nav.D3.Navmesh.Current.Navigator.GoToPosition;
                while (goToPosition.IsEmpty)
                    await Task.Delay(10);

                SharpDX.Vector3 goToPositionVector = new SharpDX.Vector3(goToPosition.X, goToPosition.Y, goToPosition.Z);
                await MoveToPosAsync(goToPositionVector);



            }

            return true;
        }
开发者ID:InjectionDev,项目名称:Dev.D3,代码行数:42,代码来源:MoveTo.cs

示例2: HitCount

            internal static int HitCount(float delay, float range, SharpDX.Vector3 sourcePosition)
            {
                byte hitcount = 0;

                foreach (var enemy in HeroManager.Enemies.Where(x => x.IsValidTarget(range, false, sourcePosition)))
                {
                    var pred = Prediction.GetPrediction(enemy, delay);

                    if (sourcePosition.Distance(pred.UnitPosition) <= range)
                        hitcount++;
                }

                return hitcount;
            }
开发者ID:47110572,项目名称:LeagueSharp-11,代码行数:14,代码来源:Func.cs


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