本文整理汇总了C#中Vector3.Distance2D方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.Distance2D方法的具体用法?C# Vector3.Distance2D怎么用?C# Vector3.Distance2D使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3
的用法示例。
在下文中一共展示了Vector3.Distance2D方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindRemnant
public static Unit FindRemnant(Vector3 pos = default(Vector3),float range=200)
{
if (pos.IsZero)
pos = Members.MyHero.NetworkPosition;
var remnant = ObjectManager.GetEntities<Unit>()
.Where(
x =>
x.ClassID == ClassID.CDOTA_Unit_Earth_Spirit_Stone && x.Team == Members.MyTeam &&
pos.Distance2D(x.NetworkPosition) <= range && x.IsAlive).OrderBy(y => pos.Distance2D(y.NetworkPosition));
return remnant.FirstOrDefault();
}
示例2: FindRemnantWithModifier
public static Unit FindRemnantWithModifier(Vector3 pos = default(Vector3),string mod="")
{
if (pos.IsZero)
pos = Members.MyHero.NetworkPosition;
var remnant = ObjectManager.GetEntities<Unit>()
.Where(
x =>
x.ClassID == ClassID.CDOTA_Unit_Earth_Spirit_Stone && x.Team == Members.MyTeam &&
pos.Distance2D(x.NetworkPosition) <= 1500 && x.IsAlive && x.HasModifier(mod)).OrderBy(y => pos.Distance2D(y.NetworkPosition));
return remnant.FirstOrDefault();
}
示例3: update_
private void update_(Vector3 startV3)
{
//raycast to test how far we could go..
Vector3 MaxRangeTestVector3 = MathEx.GetPointAt(startV3, Range, MathEx.ToRadians(DirectionDegrees));
Vector2 RaycastTestV2;
//we use main grid providers raycast to test since we are looking at how far we can travel and not if anything is blocking us.
if (Navigation.MGP.Raycast(startV3.ToVector2(), MaxRangeTestVector3.ToVector2(), out RaycastTestV2))
{//Set our endpoint at the Hit point
MaxRangeTestVector3 = RaycastTestV2.ToVector3();
MaxRangeTestVector3.Z = Navigation.MGP.GetHeight(MaxRangeTestVector3.ToVector2()); //adjust height acordingly!
}
Range = Vector3.Distance2D(ref startV3, ref MaxRangeTestVector3);
//lets see if we can stand here at all?
if (!Navigation.MGP.CanStandAt(MaxRangeTestVector3))
{
//just because raycast set our max range, we need to see if we can use that cell as a walking point!
if (!Navigation.CanRayCast(startV3, MaxRangeTestVector3, NavCellFlags.AllowWalk))
{
//loop to find a walkable range.
float currentRange = Range - 2.5f;
float directionRadianFlipped = Navigation.FindDirection(MaxRangeTestVector3, startV3, true);
int maxTestAttempts = (int)(currentRange / 2.5f);
for (int i = 0; i < maxTestAttempts; i++)
{
Vector3 newtestPoint = MathEx.GetPointAt(MaxRangeTestVector3, currentRange, directionRadianFlipped);
newtestPoint.Z = Navigation.MGP.GetHeight(newtestPoint.ToVector2());//update Z
if (Navigation.CanRayCast(startV3, newtestPoint, NavCellFlags.AllowWalk))
{
MaxRangeTestVector3 = newtestPoint;
break;
}
if (currentRange - 2.5f <= 0f) break;
currentRange = -2.5f;
}
Range = currentRange;
}
}
EndingPoint = MaxRangeTestVector3;
StartingPoint = startV3;
Range = startV3.Distance2D(MaxRangeTestVector3); //(float)GridPoint.GetDistanceBetweenPoints(StartingPoint, EndingPoint);
Center = MathEx.GetPointAt(startV3, Range / 2, MathEx.ToRadians(DirectionDegrees));
}
示例4: ChainTreePosition
private Tree ChainTreePosition(Vector3 endPosition)
{
return
allTrees.Where(
x =>
x.Distance2D(AbilityOwner) <= GetCastRange()
&& NavMesh.GetCellFlags(x.Position).HasFlag(NavMeshCellFlags.Tree)
&& Math.Abs(
endPosition.Distance2D(x.Position) + AbilityOwner.Distance2D(x.Position)
- AbilityOwner.Distance2D(endPosition)) < 20)
.OrderBy(x => AbilityOwner.Distance2D(x.Position))
.ThenBy(x => AbilityOwner.FindRelativeAngle(x.Position))
.FirstOrDefault();
}
示例5: GetDistance
public float GetDistance(Vector3 position)
{
return IsVsisible ? position.Distance2D(Hero) : GetPosition().Distance2D(position);
}