本文整理汇总了C#中System.Vector2.LSExtend方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.LSExtend方法的具体用法?C# Vector2.LSExtend怎么用?C# Vector2.LSExtend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector2
的用法示例。
在下文中一共展示了Vector2.LSExtend方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InMiddileWall
public static bool InMiddileWall(Vector2 firstwall, Vector2 lastwall)
{
var midwall = new Vector2((firstwall.X + lastwall.X) / 2, (firstwall.Y + lastwall.Y) / 2);
var point = midwall.LSExtend(Game.CursorPos.LSTo2D(), 50);
for (int i = 0; i <= 350; i = i + 10)
{
var testpoint = point.BadaoRotateAround(midwall, i);
var flags = NavMesh.GetCollisionFlags(testpoint.X, testpoint.Y);
if (!flags.HasFlag(CollisionFlags.Wall) && !flags.HasFlag(CollisionFlags.Building))
{
return false;
}
}
return true;
}
示例2: GeneratePath
private static Queue<Vector2> GeneratePath(Vector2 start, Vector2 end)
{
//return PathGenerator.GeneratePath(start.ToWorldPoint().To2D(), end.ToWorldPoint().To2D());
var d = start.LSDistance(end);
var path = new Queue<Vector2>();
if (d < 75)
{
path.Enqueue(end);
return path;
}
var increment = (int) d / 30; //(2 * d / FPS)
var count = 0;
for (var i = 0; i < d; i += increment)
{
if (i > d)
{
break;
}
var point = start.LSExtend(end, i);
if (count++ % 10 == 0)
{
point.Randomize(10, 50);
if (count % 6 == 0)
{
point.Randomize(50, 100);
}
}
path.Enqueue(point);
}
path.Enqueue(end);
return path;
}
示例3: GetRadiusPoints
public static List<Vector2> GetRadiusPoints(Vector2 targetpredictedpos, Vector2 passivepredictedposition)
{
List<Vector2> RadiusPoints = new List<Vector2>();
for (int i = 50; i <= 300; i = i + 25)
{
var x = targetpredictedpos.LSExtend(passivepredictedposition, i);
for (int j = -45; j <= 45; j = j + 5)
{
RadiusPoints.Add(x.RotateAround(targetpredictedpos, j * (float)(Math.PI / 180)));
}
}
return RadiusPoints;
}
示例4: castWOnAngle
private void castWOnAngle(Vector2 playerPos, Vector2 targetPos, float ag)
{
var posW = playerPos.LSExtend(targetPos, azir.Spells.W.Range);
if (!RotatePoint(posW, playerPos, ag).LSIsWall())
azir.Spells.W.Cast(RotatePoint(posW, playerPos, ag));
}
示例5: GetCollisions
/// <summary>
/// Gets collided units & flags
/// </summary>
/// <param name="from">Start position</param>
/// <param name="to">End position</param>
/// <param name="width">Rectangle scale</param>
/// <param name="delay">Spell delay</param>
/// <param name="missileSpeed">Spell missile speed</param>
/// <returns>Collision result as <see cref="Collision.Result"/></returns>
public static Result GetCollisions(Vector2 from, Vector2 to, float range, float width, float delay, float missileSpeed = 0, bool isArc = false)
{
List<Obj_AI_Base> collidedUnits = new List<Obj_AI_Base>();
var spellHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(from, to.LSExtend(from, -width), width));
if (isArc)
{
spellHitBox = ClipperWrapper.MakePaths(new SPrediction.Geometry.Polygon(
ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.LSDistance(from) / 900), 410, 200 * (to.LSDistance(from) / 900)),
ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.LSDistance(from) / 900), 410, 320 * (to.LSDistance(from) / 900))));
}
Flags _colFlags = Flags.None;
var collidedMinions = MinionManager.GetMinions(range + 100, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None).AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius + 15)), spellHitBox));
var collidedEnemies = HeroManager.Enemies.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox));
var collidedAllies = HeroManager.Allies.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox));
if (collidedMinions != null && collidedMinions.Count() != 0)
{
collidedUnits.AddRange(collidedMinions);
_colFlags |= Flags.Minions;
}
if (collidedEnemies != null && collidedEnemies.Count() != 0)
{
collidedUnits.AddRange(collidedEnemies);
_colFlags |= Flags.EnemyChampions;
}
if (collidedAllies != null && collidedAllies.Count() != 0)
{
collidedUnits.AddRange(collidedAllies);
_colFlags |= Flags.AllyChampions;
}
if (CheckWallCollision(from, to))
_colFlags |= Flags.Wall;
if (CheckYasuoWallCollision(from, to, width))
_colFlags |= Flags.YasuoWall;
return new Result(collidedUnits, _colFlags);
}
示例6: CheckWallCollision
/// <summary>
/// Checks wall collisions
/// </summary>
/// <param name="from">Start position</param>
/// <param name="to">End position</param>
/// <returns>true if collision found</returns>
public static bool CheckWallCollision(Vector2 from, Vector2 to)
{
float step = from.LSDistance(to) / 20;
for (var i = 0; i < 20; i++)
{
var p = from.LSExtend(to, step * i);
if (NavMesh.GetCollisionFlags(p.X, p.Y).HasFlag(CollisionFlags.Wall))
return true;
}
return false;
}
示例7: willColide
public static bool willColide(Skillshot ss, Vector2 from, float speed, Vector2 direction, float radius)
{
Vector2 ssVel = ss.Direction.Normalized() * ss.SpellData.MissileSpeed;
Vector2 dashVel = direction * speed;
Vector2 a = ssVel - dashVel;//true direction + speed
Vector2 realFrom = from.LSExtend(direction, ss.SpellData.Delay + speed);
if (!ss.IsAboutToHit((int)((dashVel.Length() / 475) * 1000) + Game.Ping + 100, ObjectManager.Player))
return false;
if (ss.IsAboutToHit(1000, ObjectManager.Player) && interCir(ss.MissilePosition, ss.MissilePosition.LSExtend(ss.MissilePosition + a, ss.SpellData.Range + 50), from,
radius))
return true;
return false;
}