本文整理汇总了C#中System.Vector3.To2D方法的典型用法代码示例。如果您正苦于以下问题:C# Vector3.To2D方法的具体用法?C# Vector3.To2D怎么用?C# Vector3.To2D使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector3
的用法示例。
在下文中一共展示了Vector3.To2D方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: bestVectorToAoeFarm
public static Vector3 bestVectorToAoeFarm(Vector3 center, float spellrange, float spellWidth, int hit = 0)
{
var minions = MinionManager.GetMinions(center, spellrange, MinionTypes.All, MinionTeam.NotAlly);
Vector3 bestPos = new Vector3();
int hits = hit;
foreach (var minion in minions)
{
if (countMinionsInrange(minion.Position, spellWidth) > hits)
{
bestPos = minion.Position;
hits = countMinionsInrange(minion.Position, spellWidth);
}
Vector3 newPos = new Vector3(minion.Position.X + 80, minion.Position.Y + 80, minion.Position.Z);
for (int i = 1; i < 4; i++)
{
var rotated = newPos.To2D().RotateAroundPoint(newPos.To2D(), 90 * i).To3D();
if (countMinionsInrange(rotated, spellWidth) > hits && player.Distance(rotated) <= spellrange)
{
bestPos = newPos;
hits = countMinionsInrange(rotated, spellWidth);
}
}
}
return bestPos;
}
示例2: bestVectorToAoeSpell
public static Vector3 bestVectorToAoeSpell(IEnumerable<AIHeroClient> heroes,
float spellrange,
float spellwidth)
{
var bestPos = new Vector3();
var hits = 0;
foreach (var hero in heroes)
{
if (countChampsAtrange(hero.Position, spellwidth) > hits)
{
bestPos = hero.Position;
hits = countChampsAtrange(hero.Position, spellwidth);
}
var newPos = new Vector3(hero.Position.X + 80, hero.Position.Y + 80, hero.Position.Z);
for (var i = 1; i < 4; i++)
{
var rotated = newPos.To2D().RotateAroundPoint(newPos.To2D(), 90*i).To3D();
if (countChampsAtrange(rotated, spellwidth) > hits && player.Distance(rotated) <= spellrange)
{
bestPos = newPos;
hits = countChampsAtrange(rotated, spellwidth);
}
}
}
return bestPos;
}
示例3: Jump
public static void Jump(Vector3 pos, bool juke = false, bool castq = true)
{
if (Math.Abs(Program._e.Cooldown) < 0.00001)
{
var extended = ObjectManager.Player.ServerPosition.To2D().Extend(pos.To2D(), 800f);
if (!JumpTo.IsValid())
JumpTo = pos.To2D();
if (Program._w.IsReady() && SoldierMgr.ActiveSoldiers.Count == 0)
{
if (juke)
{
var outRadius = 250 / (float)Math.Cos(2 * Math.PI / 12);
for (var i = 1; i <= 12; i++)
{
var angle = i * 2 * Math.PI / 12;
var x = ObjectManager.Player.Position.X + outRadius * (float)Math.Cos(angle);
var y = ObjectManager.Player.Position.Y + outRadius * (float)Math.Sin(angle);
if (NavMesh.GetCollisionFlags(x, y).HasFlag(CollisionFlags.Wall) && !ObjectManager.Player.ServerPosition.To2D().Extend(new Vector2(x, y), 500f).IsWall())
{
Program._w.Cast(ObjectManager.Player.ServerPosition.To2D().Extend(new Vector2(x, y), 800f));
return;
}
}
}
Program._w.Cast(extended);
}
if (SoldierMgr.ActiveSoldiers.Count > 0 && Program._q.IsReady())
{
var closestSoldier = SoldierMgr.ActiveSoldiers.MinOrDefault(s => s.Position.To2D().Distance(extended, true));
CastELocation = closestSoldier.Position.To2D();
CastQLocation = closestSoldier.Position.To2D().Extend(JumpTo, 800f);
if (CastELocation.Distance(JumpTo) > ObjectManager.Player.ServerPosition.To2D().Distance(JumpTo) && !juke && castq)
{
CastQLocation = extended;
CastET = Utils.TickCount + 250;
Program._q.Cast(CastQLocation);
}
else
{
Program._e.Cast(CastELocation, true);
if (ObjectManager.Player.ServerPosition.To2D().Distance(CastELocation) < 700 && castq)
LeagueSharp.Common.Utility.DelayAction.Add(250, () => Program._q.Cast(CastQLocation, true));
}
}
}
else
{
if (Program._q.IsReady() && CastELocation.Distance(ObjectManager.Player.ServerPosition) <= 200 && castq)
Program._q.Cast(CastQLocation, true);
JumpTo = Vector2.Zero;
}
}
示例4: RotatePosition
public static Vector3 RotatePosition(Vector3 path)
{
var rotateAroundPoint = path.To2D().RotateAroundPoint(Player.Instance.Position.To2D(), 180);
var finalPath = new Vector3(rotateAroundPoint,
NavMesh.GetHeightForPosition(rotateAroundPoint.X, rotateAroundPoint.Y));
return finalPath;
}
示例5: GetCastMinionsPredictedPositions
public static List<Vector2> GetCastMinionsPredictedPositions(List<Obj_AI_Base> minions,
float delay,
float width,
float speed,
Vector3 from,
float range,
bool collision,
SkillshotType stype,
Vector3 rangeCheckFrom = new Vector3())
{
var result = new List<Vector2>();
from = from.To2D().IsValid() ? from : ObjectManager.Player.ServerPosition;
foreach (var minion in minions)
{
var pos = Prediction.GetPrediction(new PredictionInput
{
Unit = minion,
Delay = delay,
Radius = width,
Speed = speed,
From = from,
Range = range,
Collision = collision,
Type = stype,
RangeCheckFrom = rangeCheckFrom
});
if (pos.Hitchance >= HitChance.High)
{
result.Add(pos.CastPosition.To2D());
}
}
return result;
}
示例6: CheckHeroCollision
public static bool CheckHeroCollision(Vector3 to)
{
if (Position == to)
return false;
return Collision.CheckEnemyHeroCollision(Position.To2D(), to.To2D(), 130f, 0.25f);
}
示例7: CountEnemysInRange
public static int CountEnemysInRange(float range, Vector3 point)
{
return (
from units in ObjectManager.Get<Obj_AI_Hero>()
where units.IsValidTarget()
select units).Count<Obj_AI_Hero>(
units => Vector2.Distance(point.To2D(), units.Position.To2D()) <= range);
}
示例8: CountAlliesInRange
public static int CountAlliesInRange(float range, Vector3 point)
{
return (
from units in ObjectManager.Get<Obj_AI_Hero>()
where units.IsAlly && units.IsVisible && !units.IsDead
select units).Count<Obj_AI_Hero>(
units => Vector2.Distance(point.To2D(), units.Position.To2D()) <= range);
}
示例9: CalculatePosition
/// <summary>
/// Calculates Reflected Position. Returns no Vector if it is a wall, building, or prop
/// </summary>
/// <param name="source">The Player or Position Being Reflected</param>
/// <param name="newPath">The Path</param>
/// <returns></returns>
private static Vector3 CalculatePosition(Obj_AI_Base source, Vector3 path)
{
var playerPosition2D = source.Position.To2D();
var pathPosition2D = path.To2D();
var reflectedPos = Vector2.Reflect(pathPosition2D, playerPosition2D).To3D();
return reflectedPos;
}
示例10: GetFirstWallPoint
public static Vector3? GetFirstWallPoint(this Vector3 from, Vector3 to, float step = 25)
{
var wallPoint = GetFirstWallPoint(from.To2D(), to.To2D(), step);
if (wallPoint.HasValue)
{
return wallPoint.Value.To3DWorld();
}
return null;
}
示例11: GetScreenPosition
public static PositionInfo GetScreenPosition(Vector3 position3D)
{
var position = position3D.To2D();
var worldCenter = GetWorldCenter();
var screenCenter = Drawing.WorldToScreen(worldCenter.To3D().SetZ(0));
if (position3D.IsOnScreen())
{
var screenPosition = Drawing.WorldToScreen(position3D);
return new PositionInfo
{
screenPosition = screenPosition,
direction = (screenPosition - screenCenter).Normalized(),
distance = worldCenter.Distance(position),
screenCollisionDistance = worldCenter.Distance(position)
};
}
var worldDir = (position - worldCenter).Normalized();
var worldClosePosition = worldCenter + worldDir * 100;
var screenClosePosition = Drawing.WorldToScreen(worldClosePosition.To3D().SetZ(0));
var dir = (screenClosePosition - screenCenter).Normalized();
var screenFarPosition = screenCenter + dir * (Math.Max(Drawing.Width, Drawing.Height) + 100);
var ray = new Ray(screenFarPosition.To3D().SetZ(0), -dir.To3D().SetZ(0));
var boundingBox = new BoundingBox(new Vector3(0, 0, -1),
new Vector3(Drawing.Width, Drawing.Height, 1));
float dist;
var hasIntersection = ray.Intersects(ref boundingBox, out dist);
if (hasIntersection)
{
var rayDirection = dir;
var distance = worldCenter.Distance(position);
var finalScreenPos = screenFarPosition - dir * (dist);
return new PositionInfo
{
screenPosition = position3D.IsOnScreen() ?
Drawing.WorldToScreen(position3D) : finalScreenPos,
direction = rayDirection,
distance = distance,
screenCollisionDistance = dist
};
}
//Console.WriteLine("no intersect");
return null;
}
示例12: 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);
}
示例13: IsFountain
public static bool IsFountain(Vector3 position)
{
float fountainRange = 750;
var map = LeagueSharp.Common.Utility.Map.GetMap();
if (map != null && map.Type == LeagueSharp.Common.Utility.Map.MapType.SummonersRift)
{
fountainRange = 1050;
}
return ObjectManager.Get<GameObject>().Where(spawnPoint => spawnPoint is Obj_SpawnPoint && spawnPoint.IsAlly).Any(spawnPoint => Vector2.Distance(position.To2D(), spawnPoint.Position.To2D()) < fountainRange);
}
示例14: getERectangle
public static Geometry.Polygon getERectangle(Vector3 finalPosition, float BoundingRadius)
{
var halfERange = 150f;
var eRectangle = new Geometry.Polygon(
Geometry.Polygon.Rectangle(
ObjectManager.Player.ServerPosition.To2D(),
ObjectManager.Player.ServerPosition.To2D().Extend(finalPosition.To2D(), halfERange),
BoundingRadius)
);
return eRectangle;
}
示例15: IsPassWall
public static bool IsPassWall(Vector3 start, Vector3 end)
{
double count = Vector3.Distance(start, end);
for (uint i = 0; i <= count; i += 25)
{
Vector2 pos = start.To2D().Extend(Player.ServerPosition.To2D(), -i);
if (IsWall(pos))
return true;
}
return false;
}