本文整理汇总了C#中System.Vector2.IsWall方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.IsWall方法的具体用法?C# Vector2.IsWall怎么用?C# Vector2.IsWall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector2
的用法示例。
在下文中一共展示了Vector2.IsWall方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UseAIMARAMPositioning
internal static void UseAIMARAMPositioning()
{
var random = new Random();
var allyZonePathList = AllyZone().OrderBy(p => random.Next()).FirstOrDefault();
var allyZoneVectorList = new List<Vector2>();
//create vectors from points and remove walls
foreach (var point in allyZonePathList)
{
var v2 = new Vector2(point.X, point.Y);
if (!v2.IsWall())
{
allyZoneVectorList.Add(v2);
}
}
var pointClosestToEnemyHQ =
allyZoneVectorList.OrderBy(p => p.Distance(HeadQuarters.EnemyHQ.Position)).FirstOrDefault();
int minNum = 250;
int maxNum = 600;
if (Heroes.Player.Team == GameObjectTeam.Order)
{
pointClosestToEnemyHQ = GetAllyPosList().OrderByDescending(b => b.Distance(HeadQuarters.AllyHQ.Position)).FirstOrDefault();
pointClosestToEnemyHQ.X = pointClosestToEnemyHQ.X - random.Next(minNum, maxNum);
pointClosestToEnemyHQ.Y = pointClosestToEnemyHQ.Y - random.Next(minNum, maxNum);
}
if (Heroes.Player.Team == GameObjectTeam.Chaos)
{
pointClosestToEnemyHQ = GetAllyPosList().OrderByDescending(q => q.Distance(HeadQuarters.AllyHQ.Position)).FirstOrDefault();
pointClosestToEnemyHQ.X = pointClosestToEnemyHQ.X + random.Next(minNum, maxNum);
pointClosestToEnemyHQ.Y = pointClosestToEnemyHQ.Y + random.Next(minNum, maxNum);
}
RandomlyChosenMove = pointClosestToEnemyHQ.To3D();
}
示例2: GetCondemnPosition
public static Vector3 GetCondemnPosition(this Vector3 position)
{
var pointList = new List<Vector3>();
pointList.Add(Vector3.Zero);
for (var j = 485; j >= 50; j -= 100)
{
var offset = (int)(2 * Math.PI * j / 100);
for (var i = 0; i <= offset; i++)
{
var angle = i * Math.PI * 2 / offset;
var point =
new Vector2(
(float)(position.X + j * Math.Cos(angle)),
(float)(position.Y - j * Math.Sin(angle))).To3D();
var cP = point.Extend(position, point.Distance(position) + 50);
if (point.IsWall() && cP.Distance(point) < 425 && !cP.UnderTurret(true) && cP.Distance(position) > 325 && cP.Distance(position) < 545 &&
(cP.CountEnemiesInRange(425) <= cP.CountAlliesInRange(325)))
{
pointList.Add(cP);
}
}
}
return pointList.OrderByDescending(p=>p.Distance(position)).FirstOrDefault();
}
示例3: GetCondemnPositions
public static IEnumerable<Vector3> GetCondemnPositions(Vector3 position)
{
var pointList = new List<Vector3>();
for (var j = 485; j >= 50; j -= 100)
{
var offset = (int)(2 * Math.PI * j / 100);
for (var i = 0; i <= offset; i++)
{
var angle = i * Math.PI * 2 / offset;
var point =
new Vector2(
(float)(position.X + j * Math.Cos(angle)),
(float)(position.Y - j * Math.Sin(angle))).To3D();
if (point.IsWall())
{
pointList.Add(point);
}
}
}
return pointList;
}
示例4: GetPos
/// <summary>
/// Returns a random position in the team zone or the position of the ally champion farthest from base
/// </summary>
internal static Vector2 GetPos()
{
//Game.PrintChat("TeamFightGetPos");
if (Game.MapId == GameMapId.HowlingAbyss)
{
var allyZonePathList = Util.AllyZone().OrderBy(p => Randoms.Rand.Next()).FirstOrDefault();
var allyZoneVectorList = new List<Vector2>();
//create vectors from points and remove walls
foreach (var point in allyZonePathList)
{
var v2 = new Vector2(point.X, point.Y);
if (!v2.IsWall())
{
allyZoneVectorList.Add(v2);
}
}
var pointClosestToEnemyHQ =
allyZoneVectorList.OrderBy(p => p.Distance(HQ.EnemyHQ.Position)).FirstOrDefault();
var zz = new Constants();
int minNum = 250;
int maxNum = 600;
var closestEnemy = Utils.GetEnemyPosList().OrderByDescending(b => b.Distance(HQ.AllyHQ.Position)).FirstOrDefault();
if (Heroes.Me.Team == GameObjectTeam.Order)
{
//Game.PrintChat("Team Order");
pointClosestToEnemyHQ = Utils.GetAllyPosList().OrderByDescending(b => b.Distance(HQ.AllyHQ.Position)).FirstOrDefault();
var randy = Randoms.Rand.Next(minNum, maxNum);
pointClosestToEnemyHQ.X = pointClosestToEnemyHQ.X - Randoms.Rand.Next(minNum, maxNum);
pointClosestToEnemyHQ.Y = pointClosestToEnemyHQ.Y - Randoms.Rand.Next(minNum, maxNum);
}
if (Heroes.Me.Team == GameObjectTeam.Chaos)
{
// Game.PrintChat("Team Chaos");
pointClosestToEnemyHQ = Utils.GetAllyPosList().OrderByDescending(q => q.Distance(HQ.AllyHQ.Position)).FirstOrDefault();
pointClosestToEnemyHQ.X = pointClosestToEnemyHQ.X + Randoms.Rand.Next(minNum, maxNum);
pointClosestToEnemyHQ.Y = pointClosestToEnemyHQ.Y + Randoms.Rand.Next(minNum, maxNum);
}
return pointClosestToEnemyHQ;
}
//for SR :s
var minion =
ObjectManager.Get<Obj_AI_Minion>().OrderBy(m => m.Distance(HQ.EnemyHQ)).FirstOrDefault().Position.To2D();
var turret = ObjectManager.Get<Obj_AI_Turret>().OrderByDescending(m => m.Distance(HQ.AllyHQ)).FirstOrDefault().Position.To2D();
return (minion != null && minion.IsValid()) ? minion : turret;
}
示例5: GetBestPositionTest
public static IOrderedEnumerable<PositionInfo> GetBestPositionTest()
{
int posChecked = 0;
int maxPosToCheck = 50;
int posRadius = 50;
int radiusIndex = 0;
Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2D;
Vector2 lastMovePos = Game.CursorPos.To2D();
var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].Cast<Slider>().CurrentValue;
var extraEvadeDistance = ObjectCache.menuCache.cache["ExtraEvadeDistance"].Cast<Slider>().CurrentValue;
if (ObjectCache.menuCache.cache["HigherPrecision"].Cast<CheckBox>().CurrentValue)
{
maxPosToCheck = 150;
posRadius = 25;
}
List<PositionInfo> posTable = new List<PositionInfo>();
List<Vector2> fastestPositions = GetFastestPositions();
Spell lowestEvadeTimeSpell;
var lowestEvadeTime = SpellDetector.GetLowestEvadeTime(out lowestEvadeTimeSpell);
foreach (var pos in fastestPositions) //add the fastest positions into list of candidates
{
posTable.Add(InitPositionInfo(pos, extraDelayBuffer, extraEvadeDistance, lastMovePos, lowestEvadeTimeSpell));
}
while (posChecked < maxPosToCheck)
{
radiusIndex++;
int curRadius = radiusIndex * (2 * posRadius);
int curCircleChecks = (int)Math.Ceiling((2 * Math.PI * (double)curRadius) / (2 * (double)posRadius));
for (int i = 1; i < curCircleChecks; i++)
{
posChecked++;
var cRadians = (2 * Math.PI / (curCircleChecks - 1)) * i; //check decimals
var pos = new Vector2((float)Math.Floor(heroPoint.X + curRadius * Math.Cos(cRadians)), (float)Math.Floor(heroPoint.Y + curRadius * Math.Sin(cRadians)));
posTable.Add(InitPositionInfo(pos, extraDelayBuffer, extraEvadeDistance, lastMovePos, lowestEvadeTimeSpell));
if (pos.IsWall())
{
//Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), (float)25, Color.White, 3);
}
/*
if (posDangerLevel > 0)
{
Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), (float) posRadius, Color.White, 3);
}*/
var path = myHero.GetPath(pos.To3D());
//Render.Circle.DrawCircle(path[path.Length - 1], (float)posRadius, Color.White, 3);
//Render.Circle.DrawCircle(new Vector3(pos.X, pos.Y, myHero.Position.Z), (float)posRadius, Color.White, 3);
//var posOnScreen = Drawing.WorldToScreen(path[path.Length - 1]);
//Drawing.DrawText(posOnScreen.X, posOnScreen.Y, Color.Aqua, "" + path.Length);
}
}
var sortedPosTable = posTable.OrderBy(p => p.isDangerousPos).ThenBy(p => p.posDangerLevel).ThenBy(p => p.posDangerCount).ThenBy(p => p.distanceToMouse);
return sortedPosTable;
}
示例6: LockROnTarget
private static void LockROnTarget()
{
var target = R.GetTarget();
if (target == null)
{
return;
}
var endPos = (Player.ServerPosition - target.ServerPosition).Normalized();
var predPos = R.GetPrediction(target).CastPosition.To2D();
var fullPoint = new Vector2(predPos.X + endPos.X * R.Range * 0.98f, predPos.Y + endPos.Y * R.Range * 0.98f);
var closestPoint = Player.ServerPosition.To2D().Closest(new List<Vector2> { predPos, fullPoint });
if (closestPoint.IsValid() && !closestPoint.IsWall() && predPos.Distance(closestPoint) > E.Range)
{
Player.IssueOrder(GameObjectOrder.MoveTo, closestPoint.To3D());
}
else if (fullPoint.IsValid() && !fullPoint.IsWall() && predPos.Distance(fullPoint) < R.Range &&
predPos.Distance(fullPoint) > 100)
{
Player.IssueOrder(GameObjectOrder.MoveTo, fullPoint.To3D());
}
}
示例7: GetRealPosition
private Vector3 GetRealPosition(Vector3 end)
{
if (end.IsWall())
{
for (var i = 0; i < 500; i = i + 2)
{
List<IntPoint> circlePath = new Geometry.Polygon.Circle(end, i, 10).ToClipperPath();
foreach (var item in circlePath)
{
Vector3 newPos = new Vector2(item.X, item.Y).To3D2();
if (!newPos.IsWall())
{
return newPos;
}
}
}
}
return end;
}
示例8: LucianRLock
public static void LucianRLock()
{
var currentTarget = Variables.spells[SpellSlot.R].GetTarget();
if (currentTarget.IsValidTarget())
{
var predictedPosition = Variables.spells[SpellSlot.R].GetPrediction(currentTarget).UnitPosition;
var directionVector = (currentTarget.ServerPosition - ObjectManager.Player.ServerPosition).Normalized();
var RRangeCoefficient = 0.95f;
var RRangeAdjusted = Variables.spells[SpellSlot.R].Range * RRangeCoefficient;
var REndPointXCoordinate = predictedPosition.X + directionVector.X * RRangeAdjusted;
var REndPointYCoordinate = predictedPosition.Y + directionVector.Y * RRangeAdjusted;
var REndPoint = new Vector2(REndPointXCoordinate, REndPointYCoordinate).To3D();
if (REndPoint.IsValid() &&
REndPoint.Distance(ObjectManager.Player.ServerPosition) < Variables.spells[SpellSlot.R].Range
&& !REndPoint.IsWall())
{
Variables.Orbwalker.SetOrbwalkingPoint(REndPoint);
}
}
}
示例9: FindWall
private void FindWall()
{
var CircleLineSegmentN = 20;
var outRadius = 700 / (float)Math.Cos(2 * Math.PI / CircleLineSegmentN);
var inRadius = 300 / (float)Math.Cos(2 * Math.PI / CircleLineSegmentN);
var bestPoint = ObjectManager.Player.Position;
for (var i = 1; i <= CircleLineSegmentN; i++)
{
var angle = i * 2 * Math.PI / CircleLineSegmentN;
var point = new Vector2(ObjectManager.Player.Position.X + outRadius * (float)Math.Cos(angle), ObjectManager.Player.Position.Y + outRadius * (float)Math.Sin(angle)).To3D();
var point2 = new Vector2(ObjectManager.Player.Position.X + inRadius * (float)Math.Cos(angle), ObjectManager.Player.Position.Y + inRadius * (float)Math.Sin(angle)).To3D();
if (!point.IsWall() && point2.IsWall() && Game.CursorPos.Distance(point) < Game.CursorPos.Distance(bestPoint))
bestPoint = point;
}
if (bestPoint != ObjectManager.Player.Position && bestPoint.Distance(Game.CursorPos) < bestPoint.Distance(ObjectManager.Player.Position) && bestPoint.CountEnemiesInRange(500) < 3)
E.Cast(bestPoint);
}
示例10: GetTumblePos
public static Vector3 GetTumblePos(this Obj_AI_Hero target)
{
//if the target is not a melee and he's alone he's not really a danger to us, proceed to 1v1 him :^ )
if (!target.IsMelee && Heroes.Player.CountEnemiesInRange(800) == 1) return Game.CursorPos;
var flash = Program.Flash;
var flashedAtTick = Program.FlashTime;
if (!flash.IsReady())
{
if (Environment.TickCount - flashedAtTick < 500) return Vector3.Zero;
}
var aRC = new Geometry.Circle(Heroes.Player.ServerPosition.To2D(), 300).ToPolygon().ToClipperPath();
var cP = Game.CursorPos;
var tP = target.ServerPosition;
var pList = new List<Vector3>();
var additionalDistance = (0.106 + Game.Ping/2000f) * target.MoveSpeed;
if ((!cP.IsWall() && !cP.UnderTurret(true) && cP.Distance(tP) > 325 && cP.Distance(tP) < 550 &&
(cP.CountEnemiesInRange(425) <= cP.CountAlliesInRange(325)))) return cP;
foreach (var p in aRC)
{
var v3 = new Vector2(p.X, p.Y).To3D();
if (target.IsFacing(Heroes.Player))
{
if (!v3.IsWall() && !v3.UnderTurret(true) && v3.Distance(tP) > 325 && v3.Distance(tP) < 550 &&
(v3.CountEnemiesInRange(425) <= v3.CountAlliesInRange(325))) pList.Add(v3);
}
else
{
if (!v3.IsWall() && !v3.UnderTurret(true) && v3.Distance(tP) > 325 &&
v3.Distance(tP) < (550 - additionalDistance) &&
(v3.CountEnemiesInRange(425) <= v3.CountAlliesInRange(325))) pList.Add(v3);
}
}
if (Heroes.Player.UnderTurret() || Heroes.Player.CountEnemiesInRange(800) == 1)
{
return pList.Count > 1 ? pList.OrderBy(el => el.Distance(cP)).FirstOrDefault() : Vector3.Zero;
}
return pList.Count > 1 ? pList.OrderByDescending(el => el.Distance(tP)).FirstOrDefault() : Vector3.Zero;
}
示例11: TreesCondemn
private static bool TreesCondemn(Vector3 position,Obj_AI_Base Hero)
{
var pointList = new List<Vector3>();
for (var j = CondemnKnockback; j >= 50; j -= 100)
{
var offset = (int)(2 * Math.PI * j / 100);
for (var i = 0; i <= offset; i++)
{
var angle = i * Math.PI * 2 / offset;
var point =
new Vector2(
(float)(position.X + j * Math.Cos(angle)),
(float)(position.Y - j * Math.Sin(angle))).To3D();
if (point.IsWall())
{
return true;
}
}
}
return false;
}
示例12: GetHitChance
private static HitChance GetHitChance(PredictionInput input)
{
var hero = input.Unit as AIHeroClient;
if (hero == null || !hero.IsValid || input.Radius <= 1f)
{
return HitChance.VeryHigh;
}
if (hero.IsCastingInterruptableSpell(true) || hero.LSIsRecalling()
|| (UnitTracker.GetLastStopTick(hero) < 0.1d && hero.IsRooted))
{
return HitChance.VeryHigh;
}
var wayPoints = hero.GetWaypoints();
var lastWaypoint = wayPoints.Last();
var heroPos = hero.Position;
var heroServerPos = hero.ServerPosition.ToVector2();
var distHeroToWaypoint = heroServerPos.Distance(lastWaypoint);
var distHeroToFrom = heroServerPos.Distance(input.From);
var distFromToWaypoint = input.From.Distance(lastWaypoint);
var angle = (lastWaypoint - heroPos.ToVector2()).AngleBetween(input.From - heroPos);
var delay = input.Delay
+ (Math.Abs(input.Speed - float.MaxValue) > float.Epsilon ? distHeroToFrom / input.Speed : 0);
var moveArea = hero.MoveSpeed * delay;
var fixRange = moveArea * 0.35f;
var minPath = 1000;
if (input.Type == SkillshotType.SkillshotCircle)
{
fixRange -= input.Radius / 2;
}
if (distFromToWaypoint <= distHeroToFrom && distHeroToFrom > input.Range - fixRange)
{
return HitChance.Medium;
}
if (distHeroToWaypoint > 0)
{
if (angle < 20 || angle > 160 || (angle > 130 && distHeroToWaypoint > 400))
{
return HitChance.VeryHigh;
}
var wallPoints = new List<Vector2>();
for (var i = 1; i <= 15; i++)
{
var circleAngle = i * 2 * Math.PI / 15;
var point = new Vector2(
heroPos.X + 350 * (float)Math.Cos(circleAngle),
heroPos.Y + 350 * (float)Math.Sin(circleAngle));
if (point.IsWall())
{
wallPoints.Add(point);
}
}
if (wallPoints.Count > 2 && !wallPoints.Any(i => heroPos.Distance(i) > lastWaypoint.Distance(i)))
{
return HitChance.VeryHigh;
}
}
if (distHeroToWaypoint > 0 && distHeroToWaypoint < 100)
{
return HitChance.Medium;
}
if (wayPoints.Count == 1)
{
return hero.Spellbook.IsAutoAttacking || UnitTracker.GetLastStopTick(hero) < 0.8d
? HitChance.High
: HitChance.VeryHigh;
}
if (UnitTracker.IsSpamSamePos(hero))
{
return HitChance.VeryHigh;
}
if (distHeroToFrom < 250 || hero.MoveSpeed < 250 || distFromToWaypoint < 250)
{
return HitChance.VeryHigh;
}
if (GamePath.PathTracker.GetCurrentPath(hero).Time > 0.25d)
{
return HitChance.VeryHigh;
}
if (distHeroToWaypoint > minPath)
{
return HitChance.VeryHigh;
}
if (hero.HealthPercent < 20 || GameObjects.Player.HealthPercent < 20)
//.........这里部分代码省略.........