本文整理汇总了C#中System.Vector3.Extend方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.Extend方法的具体用法?C# Vector3.Extend怎么用?C# Vector3.Extend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector3
的用法示例。
在下文中一共展示了Vector3.Extend方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MinionCollideLine
public static bool MinionCollideLine(Vector3 lineStart, Vector3 lineFinish, Spell spell)
{
var minion =
MinionManager.GetMinions(spell.Range, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.Health);
// Render.Circle.DrawCircle(ObjectManager.Player.Position, 100, System.Drawing.Color.Brown, 2);
// Render.Circle.DrawCircle(line_finish, 10, System.Drawing.Color.Red, 2);
var d = lineStart.Distance(lineFinish);
// dis = (int)(dis /spell.Width);
var circles = new List<Circle>();
for (var i = 0; i < d; i += 10)
{
var dist = i > d ? d : i;
var point = lineStart.Extend(lineFinish, +dist);
circles.Add(new Circle(point, spell.Width));
}
foreach (var c in circles)
{
foreach (var m in minion)
{
if (Geometry.CircleCircleIntersection(c.pos.To2D(), m.Position.To2D(), c.range, 100).Count()!=0)
{
return true;
}
}
}
// foreach(Obj_AI_Base m in minion)
// {
// m.
// }
// Geometry.cu
return false;
}
示例2: Move_Draw
public static void Move_Draw(Vector3 Spell_Start, Vector3 Spell_End, double Spell_Time, int Distance, int Type)
{
if (Spell_Start.Distance(Spell_End) > Distance){var dis = Spell_Start.Distance(Spell_End) - Distance;Spell_End = Spell_End.Extend(Spell_Start, +dis);}
Render.Circle.DrawCircle(Spell_Start, 50, System.Drawing.Color.PaleVioletRed, 1);
Render.Circle.DrawCircle(Spell_End, 50, System.Drawing.Color.LawnGreen, 1);
var from = Drawing.WorldToScreen(Spell_Start);var to = Drawing.WorldToScreen(Spell_End);
Drawing.DrawLine(from[0], from[1], to[0], to[1], 1, System.Drawing.Color.LawnGreen);
Drawing.DrawText(from[0], from[1], System.Drawing.Color.PaleVioletRed, "Start");
Drawing.DrawText(to[0], to[1], System.Drawing.Color.PaleVioletRed, "End");
}
示例3: GetFirstWallPoint
public Vector3 GetFirstWallPoint(Vector3 start, Vector3 end, float range)
{
if (end.IsValid() && start.Distance(end) <= range)
{
var newPoint = start.Extend(end, range);
return NavMesh.GetCollisionFlags(newPoint) == CollisionFlags.Wall || newPoint.IsWall()
? newPoint
: Vector3.Zero;
}
return Vector3.Zero;
}
示例4: GetTarget
//my condemn logic so far
public static Obj_AI_Base GetTarget(Vector3 fromPosition)
{
var targetList =
EntityManager.Heroes.Enemies.Where(
h =>
h.IsValidTarget(Manager.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 = Manager.SpellManager.E2.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 < Manager.MenuManager.CondemnPushDistance; i += (int)enemy.BoundingRadius)
{
var finalPosition = fromPosition.Extend(position, distance + i).To3D();
var j4Flag = Manager.MenuManager.J4Flag && (Variables.IsJ4Flag(finalPosition, enemy));
if (NavMesh.GetCollisionFlags(finalPosition).HasFlag(CollisionFlags.Wall)
|| NavMesh.GetCollisionFlags(finalPosition).HasFlag(CollisionFlags.Building) || j4Flag)
{
wallsFound++;
break;
}
}
}
if (wallsFound >= Manager.MenuManager.CondemnHitchance)
{
return enemy;
}
}
return null;
}
示例5: IsOverWall
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).ToVector2();
if (tempPosition.IsWall())
{
return true;
}
}
return false;
}
示例6: GetFirstWallPoint
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;
}
示例7: IsOverWall
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() || (!NavMesh.IsWallOfGrass(start, 65) && NavMesh.IsWallOfGrass(tempPosition.To3D(), 65)))
{
return true;
}
}
return false;
}
示例8: DoPositionsCrossWall
internal static bool DoPositionsCrossWall(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;
}
示例9: IsOverWall
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).To3D();
var collFlags = NavMesh.GetCollisionFlags(tempPosition);
if (collFlags.HasFlag(CollisionFlags.Wall) || collFlags.HasFlag(CollisionFlags.Building))
{
return true;
}
}
return false;
}
示例10: CastW
private void CastW(Obj_AI_Hero target, Vector3 from, Vector3 to)
{
var positions = new List<Vector3>();
for (int i = 1; i < 11; i++)
{
positions.Add(from.Extend(to, 42 * i));
}
var best =
positions.OrderByDescending(p => p.Distance(target.Position))
.FirstOrDefault(
p => !p.IsWall() && p.Distance(player.Position) < W.Range && p.Distance(target.Position) > 350);
if (best != null && best.IsValid())
{
W.Cast(best, config.Item("packets").GetValue<bool>());
}
}
示例11: DrawArrow
public static void DrawArrow(Vector3 starPosition, Vector3 endPosition, int angle, int linelength, int arrowsize, Color arrowColor)
{
var playerPositionExtend = starPosition.Extend(endPosition, linelength);
var extendPlayerPos = Drawing.WorldToScreen(playerPositionExtend);
var afterStartPosition = playerPositionExtend.Extend(starPosition,
playerPositionExtend.Distance(starPosition) - 110);
var starPos = Drawing.WorldToScreen(afterStartPosition);
Drawing.DrawLine(starPos, extendPlayerPos, 1, arrowColor);
var playerposextend = playerPositionExtend.Extend(starPosition, -130);
var firstLineRotate = RotateByX(playerposextend.To2D(), starPosition.To2D(), angle);
var secondLineRotate = RotateByX(playerposextend.To2D(), starPosition.To2D(), -angle);
var extend1 = playerposextend.Extend(firstLineRotate.To3D(), arrowsize);
var extend2 = playerposextend.Extend(secondLineRotate.To3D(), arrowsize);
var extendpoint = Drawing.WorldToScreen(playerposextend);
var firstLineRotatePos = Drawing.WorldToScreen(extend1);
var secondLineRotatePos = Drawing.WorldToScreen(extend2);
Drawing.DrawLine(extendpoint, firstLineRotatePos, 1, arrowColor);
Drawing.DrawLine(extendpoint, secondLineRotatePos, 1, arrowColor);
}
示例12: GetNeededPoinits
public static Point[] GetNeededPoinits(
Vector3 startPosition,
Vector3 endPosition,
float startWidth,
float endWidth = 0)
{
if (endWidth <= 0)
{
endWidth = startWidth;
}
endPosition = startPosition.Extend(endPosition, startPosition.Distance2D(endPosition) + endWidth / 2);
var difference = startPosition - endPosition;
var rotation = difference.Rotated(MathUtil.DegreesToRadians(90));
rotation.Normalize();
var start = rotation * startWidth;
var end = rotation * endWidth;
var rightStartPosition = startPosition + start;
var leftStartPosition = startPosition - start;
var rightEndPosition = endPosition + end;
var leftEndPosition = endPosition - end;
/*Vector2 leftStart, rightStart, leftEnd, rightEnd;
Drawing.WorldToScreen(leftStartPosition, out leftStart);
Drawing.WorldToScreen(rightStartPosition, out rightStart);
Drawing.WorldToScreen(leftEndPosition, out leftEnd);
Drawing.WorldToScreen(rightEndPosition, out rightEnd);
Drawing.DrawLine(leftStart, rightStart, Color.Orange);
Drawing.DrawLine(rightStart, rightEnd, Color.Orange);
Drawing.DrawLine(rightEnd, leftEnd, Color.Orange);
Drawing.DrawLine(leftEnd, leftStart, Color.Orange);*/
var p1 = new Point((int) rightStartPosition.X, (int) rightStartPosition.Y);
var p2 = new Point((int) leftStartPosition.X, (int) leftStartPosition.Y);
var p3 = new Point((int) rightEndPosition.X, (int) rightEndPosition.Y);
var p4 = new Point((int) leftEndPosition.X, (int) leftEndPosition.Y);
return new[] {p1, p2, p4, p3};
}
示例13: CollidesWithWall
/// <summary>
/// Collideses the with wall.
/// </summary>
/// <param name="start">The start.</param>
/// <param name="end">The end.</param>
/// <returns></returns>
internal static bool CollidesWithWall(Vector3 start, Vector3 end)
{
if (Utils.TickCount - _wallCastT > 4000)
{
return false;
}
GameObject wall = null;
foreach (var gameObject in
ObjectManager.Get<GameObject>()
.Where(
gameObject =>
gameObject.IsValid &&
Regex.IsMatch(
gameObject.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase))
)
{
wall = gameObject;
}
if (wall == null)
{
return false;
}
var level = wall.Name.Substring(wall.Name.Length - 6, 1);
var wallWidth = (300 + 50 * Convert.ToInt32(level));
var wallDirection =
(wall.Position.To2D() - _yasuoWallCastedPos).Normalized().Perpendicular();
var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection;
var wallEnd = wallStart - wallWidth * wallDirection;
for (int i = 0; i < start.Distance(end); i += 30)
{
var currentPosition = start.Extend(end, i);
if (wallStart.Intersection(wallEnd, currentPosition.To2D(), start.To2D()).Intersects)
{
return true;
}
}
return false;
}
示例14: GetWallLength
internal 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);
}
示例15: IsWallBetween
public static bool IsWallBetween(Vector3 start, Vector3 end, int step = 3)
{
if (start.IsValid() && end.IsValid() && step > 0)
{
var distance = start.Distance(end);
for (var i = 0; i < distance; i = i + step)
{
if (NavMesh.GetCollisionFlags(start.Extend(end, i)) == CollisionFlags.Wall)
{
return true;
}
}
}
return false;
}