本文整理汇总了C#中Vector3.Extend方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.Extend方法的具体用法?C# Vector3.Extend怎么用?C# Vector3.Extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector3
的用法示例。
在下文中一共展示了Vector3.Extend方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWallWidth
private static float GetWallWidth(Vector3 start, Vector3 direction, int maxWallWidth = 350, int step = 1)
{
var thickness = 0f;
if (!start.IsValid() || !direction.IsValid())
{
return thickness;
}
for (var i = 0; i < maxWallWidth; i = i + step)
{
if (NavMesh.GetCollisionFlags(start.Extend(direction, i)) == CollisionFlags.Wall || start.Extend(direction, i).IsWall())
{
thickness += step;
}
}
return thickness;
}
示例2: GetTarget
public static Obj_AI_Base GetTarget(Vector3 fromPosition)
{
var targetList =
EntityManager.Heroes.Enemies.Where(
h =>
h.IsValidTarget(SpellManager.E.Range) && !h.HasBuffOfType(BuffType.SpellShield)
&& !h.HasBuffOfType(BuffType.SpellImmunity)
&& h.Health > ObjectManager.Player.GetAutoAttackDamage(h, true) * 2).ToList();
if (!targetList.Any())
{
return null;
}
foreach (var enemy in targetList)
{
var prediction = SpellManager.E.GetPrediction(enemy);
var predictionsList = new List<Vector3>
{
enemy.ServerPosition,
enemy.Position,
prediction.CastPosition,
prediction.UnitPosition
};
var wallsFound = 0;
foreach (var position in predictionsList)
{
var distance = fromPosition.Distance(position);
for (var i = 0; i < Config.Settings.Condemn.PushDistance; i += (int)enemy.BoundingRadius)
{
var finalPosition = fromPosition.Extend(position, distance + i).To3D();
if (NavMesh.GetCollisionFlags(finalPosition).HasFlag(CollisionFlags.Wall)
|| NavMesh.GetCollisionFlags(finalPosition).HasFlag(CollisionFlags.Building))
{
wallsFound++;
break;
}
}
}
if (wallsFound >= Config.Settings.Condemn.Accuracy)
{
return enemy;
}
}
return null;
}
示例3: GetWallWidth
public static float GetWallWidth(Vector3 start, Vector3 direction, int maxWallWidth = 350, int step = 1)
{
var thickness = 0f;
if (start.IsValid() && direction.IsValid())
{
for (var i = 0; i < maxWallWidth; i = i + step)
{
if (NavMesh.GetCollisionFlags(start.Extend(direction, i)) == CollisionFlags.Wall
|| start.Extend(direction, i).IsWall())
{
// Console.WriteLine("Thickness: " + thickness);
thickness += step;
}
else
{
return thickness;
}
}
}
return thickness;
}
示例4: GetFirstWallPoint
public static Vector3 GetFirstWallPoint(Vector3 start, Vector3 end, int step = 1)
{
if (start.IsValid() && end.IsValid())
{
var distance = start.Distance(end);
for (var i = 0; i < distance; i = i + step)
{
var newPoint = start.Extend(end, i);
if (NavMesh.GetCollisionFlags(newPoint) == CollisionFlags.Wall || newPoint.IsWall())
{
return newPoint;
}
}
}
return Vector3.Zero;
}
示例5: FirstWallPoint
/// <summary>
/// Gets the first wall point/node, w/e.
/// </summary>
/// <param name="playerPosition"></param>
/// <param name="endPosition"></param>
/// <param name="step"></param>
/// <returns></returns>
public Vector3 FirstWallPoint(Vector3 playerPosition, Vector3 endPosition, int step = 1)
{
if (!playerPosition.IsValid() || !endPosition.IsValid())
{
return Vector3.Zero;
}
var distance = playerPosition.Distance(endPosition);
for (var i = 0; i < distance; i = i + step)
{
var newPoint = playerPosition.Extend(endPosition, i);
if (NavMesh.GetCollisionFlags(newPoint) == CollisionFlags.Wall || newPoint.IsWall())
{
return newPoint;
}
}
return Vector3.Zero;
}
示例6: WardBush
private static void WardBush(Vector3 from, Vector3 endPosition)
{
if (!MenuExtensions.GetItemValue<bool>("iseriesr.vayne.misc.condemn.wardbush"))
{
return;
}
var wardSlot = Items.GetWardSlot();
if (wardSlot != null)
{
var wardPos = from.Extend(endPosition, from.Distance(endPosition) - 65f);
if (NavMesh.IsWallOfGrass(wardPos, 65))
{
if (Items.CanUseItem(wardSlot.Slot))
{
Items.UseItem(wardSlot.Slot, wardPos);
}
}
}
}
示例7: AnyWallInBetween
/// <summary>
/// Returns true if there is a Wall between X pos and Y pos.
/// </summary>
public static bool AnyWallInBetween(Vector3 startPos, Vector3 endPos)
{
for (var i = 0; i < startPos.Distance(endPos); i++)
{
if (NavMesh.GetCollisionFlags(startPos.Extend(endPos, i)) == CollisionFlags.Wall)
{
return true;
}
}
return false;
}
示例8: Extend
public static Vector3 Extend(Vector3 from, Vector3 to, float x)
{
return from.Extend(to, x);
}
示例9: IsOverWall
/// <summary>
/// Checks For Wall
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public static bool IsOverWall(Vector3 start, Vector3 end)
{
double distance = Vector3.Distance(start, end);
for (uint i = 0; i < distance; i += 10)
{
var tempPosition = start.Extend(end, i).To2D();
if (tempPosition.IsWall())
{
return true;
}
}
return false;
}
示例10: GetWallLength
/// <summary>
/// Wall Lentgh
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public static float GetWallLength(Vector3 start, Vector3 end)
{
double distance = Vector3.Distance(start, end);
var firstPosition = Vector3.Zero;
var lastPosition = Vector3.Zero;
for (uint i = 0; i < distance; i += 10)
{
var tempPosition = start.Extend(end, i);
if (tempPosition.IsWall() && firstPosition == Vector3.Zero)
{
firstPosition = tempPosition;
}
lastPosition = tempPosition;
if (!lastPosition.IsWall() && firstPosition != Vector3.Zero)
{
break;
}
}
return Vector3.Distance(firstPosition, lastPosition);
}
示例11: GetFirstWallPoint
/// <summary>
/// First wall Point
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public static Vector3 GetFirstWallPoint(Vector3 start, Vector3 end)
{
double distance = Vector3.Distance(start, end);
for (uint i = 0; i < distance; i += 10)
{
var tempPosition = start.Extend(end, i);
if (!tempPosition.IsWall())
{
return tempPosition.Extend(start, -35);
}
}
return Vector3.Zero;
}
示例12: getPos
static Vector3 getPos(AIHeroClient target, int c)
{
AIHeroClient ally1 = EntityManager.Heroes.Allies.FirstOrDefault(ally => ally.HealthPercent > Settings.InsecToHP && Player.Instance.Distance(ally) <= Settings.InsecToRange && ally.Name != Player.Instance.Name);
Vector3 moveTo = new Vector3();
Vector3 allyPos = new Vector3();
Vector3 point = new Vector3();
if (ally1 != null)
point = ally1.Position;
else
point = Vector3.Zero;
allyPos = point;
if (allyPos == Vector3.Zero) return Vector3.Zero;
Vector3 targetPos = target.Position;
//From the Ally position we extended (the distance between both + 100) units in the target direction THANKS @WUJU!
if (c == 3) { moveTo = allyPos.Extend(target, ally1.Distance(target) - Settings.Dist).To3DWorld(); }
if (c == 1) { moveTo = allyPos.Extend(target, ally1.Distance(target) + Settings.Dist).To3DWorld(); }
if (NavMesh.GetCollisionFlags(moveTo) == CollisionFlags.Building || NavMesh.GetCollisionFlags(moveTo) == CollisionFlags.Wall)
{
return Vector3.Zero;
}
_moveTo = moveTo;
return moveTo;
}