本文整理汇总了C#中Obj_AI_Base.GetWaypoints方法的典型用法代码示例。如果您正苦于以下问题:C# Obj_AI_Base.GetWaypoints方法的具体用法?C# Obj_AI_Base.GetWaypoints怎么用?C# Obj_AI_Base.GetWaypoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj_AI_Base
的用法示例。
在下文中一共展示了Obj_AI_Base.GetWaypoints方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsCloser
internal static bool IsCloser(this Vector2 point, Obj_AI_Base target)
{
var lastwp = target.GetWaypoints().LastOrDefault();
var midwpnum = target.GetWaypoints().Count() / 2;
var midwp = target.GetWaypoints()[midwpnum];
return point.Distance(lastwp) < Player.Distance(lastwp) || point.Distance(midwp) < Player.Distance(midwp);
}
示例2: FastPrediction
public static FastPredResult FastPrediction(Vector2 from, Obj_AI_Base unit, int delay, int speed)
{
var tDelay = delay/1000f + @from.Distance(unit)/speed;
var d = tDelay*unit.MoveSpeed;
var path = unit.GetWaypoints();
if (path.PathLength() > d)
{
return new FastPredResult
{
IsMoving = true,
CurrentPos = unit.ServerPosition.To2D(),
PredictedPos = path.CutPath((int) d)[0]
};
}
if (path.Count == 0)
{
return new FastPredResult
{
IsMoving = false,
CurrentPos = unit.ServerPosition.To2D(),
PredictedPos = unit.ServerPosition.To2D()
};
}
return new FastPredResult
{
IsMoving = false,
CurrentPos = path[path.Count - 1],
PredictedPos = path[path.Count - 1]
};
}
示例3: Input
public Input(Obj_AI_Base _target, Spell s, Vector3 _from, Vector3 _rangeCheckFrom)
{
Target = _target;
SpellDelay = s.Delay;
SpellMissileSpeed = s.Speed;
SpellWidth = s.Width;
SpellRange = s.Range;
SpellCollisionable = s.Collision;
SpellSkillShotType = s.Type;
Path = Target.GetWaypoints();
if (Target is Obj_AI_Hero)
{
Obj_AI_Hero t = Target as Obj_AI_Hero;
AvgReactionTime = t.AvgMovChangeTime();
LastMovChangeTime = t.LastMovChangeTime();
AvgPathLenght = t.AvgPathLenght();
}
else
{
AvgReactionTime = 0;
LastMovChangeTime = 0;
AvgPathLenght = 0;
}
From = _from;
RangeCheckFrom = _rangeCheckFrom;
}
示例4: IsCloserWP
internal static bool IsCloserWP(this Vector2 point, Obj_AI_Base target)
{
var wp = target.GetWaypoints();
var lastwp = wp.LastOrDefault();
var wpc = wp.Count();
var midwpnum = wpc / 2;
var midwp = wp[midwpnum];
var plength = wp[0].LSDistance(lastwp);
return (point.LSDistance(target.ServerPosition, true) <= Player.LSDistance(target.ServerPosition, true)) || ((plength <= Player.LSDistance(target.ServerPosition) * 1.2f && point.LSDistance(lastwp.To3D()) < Player.LSDistance(lastwp.To3D()) || point.LSDistance(midwp.To3D()) < Player.LSDistance(midwp)));
}
示例5: CupcakeIngredients
/// <summary>
/// Initializes a new instance of the <see cref="CupcakeIngredients" /> class.
/// </summary>
/// <param name="target">
/// The target.
/// </param>
/// <param name="spell">
/// The spell.
/// </param>
/// <param name="source">
/// The source. <c>null</c> if the source is the Player.
/// </param>
public CupcakeIngredients(Obj_AI_Base target, Spell spell, Obj_AI_Base source = null)
{
this.Delay = spell.Delay;
this.MissileSpeed = spell.Speed;
this.SourcePosition = source == null
? ObjectManager.Player.ServerPosition.To2D().ToNumlVector()
: source.ServerPosition.To2D().ToNumlVector();
this.TargetMoveSpeed = target.MoveSpeed;
this.TargetPosition = target.ServerPosition.To2D().ToNumlVector();
this.Waypoints = target.GetWaypoints().Select(x => x.ToNumlVector());
this.Width = spell.Width;
}
示例6: GetAngle
private static double GetAngle(this Vector3 from, Obj_AI_Base target)
{
var posTarget = target.ServerPosition;
var lastWaypoint = target.GetWaypoints().Last();
if (posTarget.ToVector2() == lastWaypoint)
{
return 60;
}
var a = Math.Pow(lastWaypoint.X - posTarget.X, 2) + Math.Pow(lastWaypoint.Y - posTarget.Y, 2);
var b = Math.Pow(lastWaypoint.X - from.X, 2) + Math.Pow(lastWaypoint.Y - from.Y, 2);
var c = Math.Pow(from.X - posTarget.X, 2) + Math.Pow(from.Y - posTarget.Y, 2);
return Math.Cos((b + c - a) / (2 * Math.Sqrt(b) * Math.Sqrt(c))) * 180 / Math.PI;
}
示例7: GetAngle
private static double GetAngle(Vector3 from, Obj_AI_Base target)
{
var c = target.ServerPosition.ToVector2();
var a = target.GetWaypoints().Last();
if (c == a)
{
return 60;
}
var b = from.ToVector2();
var ab = Math.Pow(a.X - b.X, 2) + Math.Pow(a.Y - b.Y, 2);
var bc = Math.Pow(b.X - c.X, 2) + Math.Pow(b.Y - c.Y, 2);
var ac = Math.Pow(a.X - c.X, 2) + Math.Pow(a.Y - c.Y, 2);
return Math.Cos((ab + bc - ac) / (2 * Math.Sqrt(ab) * Math.Sqrt(bc))) * 180 / Math.PI;
}
示例8: FastPrediction
public static FastPredResult FastPrediction(Vector2 from, Obj_AI_Base unit, int delay, int speed)
{
var tDelay = delay / 1000f + (Math.Abs(speed - int.MaxValue) > 0 ? unit.Distance(@from) / speed : 0);
var d = tDelay * unit.MoveSpeed;
var path = unit.GetWaypoints();
if (path.LSPathLength() > d)
{
return new FastPredResult
{
IsMoving = true, CurrentPos = unit.ServerPosition.ToVector2(),
PredictedPos = path.CutPath((int)d)[0]
};
}
return new FastPredResult
{ IsMoving = false, CurrentPos = path[path.Count - 1], PredictedPos = path[path.Count - 1] };
}
示例9: GetFastUnitPosition
/// <summary>
/// Gets fast-predicted unit position
/// </summary>
/// <param name="target">Target</param>
/// <param name="delay">Spell delay</param>
/// <param name="missileSpeed">Spell missile speed</param>
/// <param name="from">Spell casted position</param>
/// <returns></returns>
public static Vector2 GetFastUnitPosition(Obj_AI_Base target, float delay, float missileSpeed = 0,
Vector2? from = null, float distanceSet = 0)
{
var path = target.GetWaypoints();
if (from == null)
from = ObjectManager.Player.ServerPosition.LSTo2D();
if (path.Count <= 1 || (target is AIHeroClient && target.Spellbook.IsChanneling) || Utility.IsImmobileTarget(target))
return target.ServerPosition.LSTo2D();
if (target.LSIsDashing())
return target.LSGetDashInfo().Path.Last();
var distance = distanceSet;
if (distance == 0)
{
var targetDistance = from.Value.LSDistance(target.ServerPosition);
var flyTime = targetDistance/missileSpeed;
if (missileSpeed != 0 && path.Count == 2)
{
var Vt = (path[1] - path[0]).LSNormalized()*target.MoveSpeed;
var Vs = (target.ServerPosition.LSTo2D() - from.Value).LSNormalized()*missileSpeed;
var Vr = Vt - Vs;
flyTime = targetDistance/Vr.Length();
}
var t = flyTime + delay + Game.Ping/2000f;
distance = t*target.MoveSpeed;
}
for (var i = 0; i < path.Count - 1; i++)
{
var d = path[i + 1].LSDistance(path[i]);
if (distance == d)
return path[i + 1];
if (distance < d)
return path[i] + distance*(path[i + 1] - path[i]).LSNormalized();
distance -= d;
}
return path.Last();
}
示例10: GetFastUnitPosition
/// <summary>
/// Gets fast-predicted unit position
/// </summary>
/// <param name="target">Target</param>
/// <param name="delay">Spell delay</param>
/// <param name="missileSpeed">Spell missile speed</param>
/// <param name="from">Spell casted position</param>
/// <returns></returns>
public static Vector2 GetFastUnitPosition(Obj_AI_Base target, float delay, float missileSpeed = 0, Vector2? from = null, float distanceSet = 0)
{
List<Vector2> path = target.GetWaypoints();
if (from == null)
from = ObjectManager.Player.ServerPosition.To2D();
if (path.Count <= 1 || (target is Obj_AI_Hero && ((Obj_AI_Hero)target).IsChannelingImportantSpell()) || Utility.IsImmobileTarget(target))
return target.ServerPosition.To2D();
if (target.IsDashing())
return target.GetDashInfo().Path.Last();
float distance = distanceSet;
if (distance == 0)
{
float targetDistance = from.Value.Distance(target.ServerPosition);
float flyTime = targetDistance / missileSpeed;
if (missileSpeed != 0 && path.Count == 2)
{
Vector2 Vt = (path[1] - path[0]).Normalized() * target.MoveSpeed;
Vector2 Vs = (target.ServerPosition.To2D() - from.Value).Normalized() * missileSpeed;
Vector2 Vr = Vt - Vs;
flyTime = targetDistance / Vr.Length();
}
float t = flyTime + delay + Game.Ping / 2000f;
distance = t * target.MoveSpeed;
}
for (int i = 0; i < path.Count - 1; i++)
{
float d = path[i + 1].Distance(path[i]);
if (distance == d)
return path[i + 1];
else if (distance < d)
return path[i] + distance * (path[i + 1] - path[i]).Normalized();
else distance -= d;
}
return path.Last();
}
示例11: PositionAfter
public static Vector2 PositionAfter(Obj_AI_Base unit, float t, float speed = float.MaxValue)
{
var distance = t * speed;
var path = unit.GetWaypoints();
for (var i = 0; i < path.Count - 1; i++)
{
var a = path[i];
var b = path[i + 1];
var d = a.Distance(b);
if (d < distance)
{
distance -= d;
}
else
{
return a + distance * (b - a).Normalized();
}
}
return path[path.Count - 1];
}
示例12: FastPrediction
public static FastPredictionResult FastPrediction(Vector2 fromVector2,
Obj_AI_Base unitAiBase,
int delay,
int speed)
{
var tickDelay = delay / 1000f + (fromVector2.Distance(unitAiBase) / speed);
var moveSpeedF = tickDelay * unitAiBase.MoveSpeed;
var path = unitAiBase.GetWaypoints();
if (path.PathLength() > moveSpeedF)
{
return new FastPredictionResult
{
IsMoving = true,
CurrentPosVector2 = unitAiBase.ServerPosition.To2D(),
PredictedPosVector2 = path.CutPath((int) moveSpeedF)[0]
};
}
if (path.Count == 0)
{
return new FastPredictionResult
{
IsMoving = false,
CurrentPosVector2 = unitAiBase.ServerPosition.To2D(),
PredictedPosVector2 = unitAiBase.ServerPosition.To2D()
};
}
return new FastPredictionResult
{
IsMoving = false,
CurrentPosVector2 = path[path.Count - 1],
PredictedPosVector2 = path[path.Count - 1]
};
}
示例13: GetBadaoPrediction
public static PredictionOutput GetBadaoPrediction(this Spell spell, Obj_AI_Base target, bool collideyasuowall = true)
{
PredictionOutput result = null;
if (!target.IsValidTarget(float.MaxValue, false))
{
return new PredictionOutput();
}
if (target.IsDashing())
{
var dashDtata = target.GetDashInfo();
result = spell.GetBadaoStandarPrediction(target,
new List<Vector2>() { target.ServerPosition.ToVector2(), dashDtata.Path.Last() }, dashDtata.Speed);
if (result.Hitchance >= HitChance.High)
result.Hitchance = HitChance.Dashing;
}
else
{
//Unit is immobile.
var remainingImmobileT = UnitIsImmobileUntil(target);
if (remainingImmobileT >= 0d)
{
var timeToReachTargetPosition = spell.Delay + target.Position.ToVector2().Distance(spell.From.ToVector2()) / spell.Speed;
if (spell.RangeCheckFrom.ToVector2().Distance(target.Position.ToVector2()) <= spell.Range)
{
if (timeToReachTargetPosition <=
remainingImmobileT + (target.BoundingRadius + spell.Width - 40) / target.MoveSpeed)
{
result = new PredictionOutput
{
CastPosition = target.ServerPosition,
UnitPosition = target.ServerPosition,
Hitchance = HitChance.Immobile
};
}
else result = new PredictionOutput
{
CastPosition = target.ServerPosition,
UnitPosition = target.ServerPosition,
Hitchance = HitChance.High
/*timeToReachTargetPosition - remainingImmobileT + input.RealRadius / input.Unit.MoveSpeed < 0.4d ? HitChance.High : HitChance.Medium*/
};
}
else
{
result = new PredictionOutput();
}
}
}
//Normal prediction
if (result == null)
{
result = spell.GetBadaoStandarPrediction(target, target.GetWaypoints());
}
//Check for collision
if (spell.Collision)
{
var positions = new List<Vector3> { result.UnitPosition, result.CastPosition, target.Position };
var originalUnit = target;
result.CollisionObjects = spell.GetCollision(positions);
result.CollisionObjects.RemoveAll(x => x.NetworkId == originalUnit.NetworkId);
result.Hitchance = result.CollisionObjects.Count > 0 ? HitChance.Collision : result.Hitchance;
}
//Check yasuo wall collision
else if (collideyasuowall)
{
var positions = new List<Vector3> { result.UnitPosition, result.CastPosition, target.Position };
var originalUnit = target;
result.CollisionObjects = spell.GetCollision(positions);
result.CollisionObjects.Any(x => x.NetworkId == ObjectManager.Player.NetworkId);
result.Hitchance = result.CollisionObjects.Any(x => x.NetworkId == ObjectManager.Player.NetworkId) ? HitChance.Collision : result.Hitchance;
}
return result;
}
示例14: GetPredictionMethod2
//.........这里部分代码省略.........
//to do: find a fuking logic
if (avgp < 400 && movt < 100)
{
hc = HitChance.High;
return target.ServerPosition.To2D();
}
}
if (IsImmobileTarget(target))
return GetImmobilePrediction(target, s, out hc, rangeCheckFrom);
if (target.IsDashing())
return GetDashingPrediction(target, s, out hc, rangeCheckFrom);
float targetDistance = rangeCheckFrom.Distance(target.ServerPosition);
float flyTimeMin = 0f;
float flyTimeMax = 0f;
if (s.Speed != 0) //skillshot with a missile
{
flyTimeMin = targetDistance / s.Speed;
flyTimeMax = s.Range / s.Speed;
}
//PATCH WARNING
float tMin = 0f + s.Delay + Game.Ping / 2000f + SpellDelay / 1000f; //0f => flyTimeMin
float tMax = flyTimeMax + s.Delay + Game.Ping / 1000f + SpellDelay / 1000f;
float pathTime = 0f;
int[] x = new int[] { -1, -1 };
for (int i = 0; i < path.Count - 1; i++)
{
float t = path[i + 1].Distance(path[i]) / target.MoveSpeed;
if (pathTime <= tMin && pathTime + t >= tMin)
x[0] = i;
if (pathTime <= tMax && pathTime + t >= tMax)
x[1] = i;
if (x[0] != -1 && x[1] != -1)
break;
pathTime += t;
}
//PATCH WARNING
if (x[0] != -1 && x[1] != -1)
{
for (int k = x[0]; k <= x[1]; k++)
{
Vector2 direction = (path[k + 1] - path[k]).Normalized();
float distance = s.Width;
int steps = (int)Math.Floor(path[k].Distance(path[k + 1]) / distance);
for (int i = 0; i < steps; i++)
{
Vector2 pA = path[k] + (direction * distance * i);
Vector2 pB = path[k] + (direction * distance * (i + 1));
Vector2 center = (pA + pB) / 2f;
float flytime = s.Speed != 0 ? rangeCheckFrom.To2D().Distance(center) / s.Speed : 0f;
float t = flytime + s.Delay + Game.Ping / 2000f + SpellDelay / 1000f;
float arriveTimeA = target.ServerPosition.To2D().Distance(pA) / target.MoveSpeed;
float arriveTimeB = target.ServerPosition.To2D().Distance(pB) / target.MoveSpeed;
if (Math.Min(arriveTimeA, arriveTimeB) <= t && Math.Max(arriveTimeA, arriveTimeB) >= t)
{
hc = GetHitChance(t, avgt, movt, avgp);
return center;
}
}
if (steps == 0)
{
float flytime = s.Speed != 0 ? rangeCheckFrom.To2D().Distance(path[x[1]]) / s.Speed : 0f;
float t = flytime + s.Delay + Game.Ping / 2000f + SpellDelay / 1000f;
hc = GetHitChance(t, avgt, movt, avgp);
return path[x[1]];
}
}
}
hc = HitChance.Impossible;
//PATCH WARNING
if (s.Type == SkillshotType.SkillshotCircle && (x[0] != -1 || x[1] != -1))
if (movt < 100)
hc = HitChance.High;
else
hc = HitChance.Medium;
return path[path.Count - 1];
}
finally
{
//check if movement changed while prediction calculations
if (!target.GetWaypoints().SequenceEqual(path))
hc = HitChance.Medium;
}
}
示例15: Obj_AI_Base_OnProcessSpellCast
private static void Obj_AI_Base_OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args)
{
Utility.DelayAction.Add(100, () =>
{
if (sender.IsVisible)
return;
if (sender.IsEnemy && Data.Config.Item("ENABLEWDHG").GetValue<bool>() && (!Data.Config.Item("ENABLEINCOMBO").GetValue<bool>() || Data.Config.Item("ENABLECOMBOKEY").GetValue<KeyBind>().Active))
{
int level = 1;
Vector3 pos = args.End;
switch (args.SData.Name.ToLower())
{
case "deceive":
{
if (args.Start.Distance(args.End) > 400)
pos = args.Start + (args.End - args.Start).Normalized() * 400;
}
break;
case "vaynetumble":
{
if (sender.HasBuff("VayneInquisition"))
{
pos = args.Start + (args.End - args.Start).Normalized() * 300;
level = 2;
}
else
return;
}
break;
case "summonerflash":
{
if (sender.IsVisible)
return;
}
break;
case "jackinthebox":
{
if (args.Start.Distance(args.End) > 425)
pos = args.Start + (args.End - args.Start).Normalized() * 425;
Data.StealthObjects.Add(new Data._odata { DisplayName = "Shaco Box", Position = pos.To2D(), EndTick = Environment.TickCount + 60000, Radius = 300 });
Utility.DelayAction.Add(60000, () => { var obj = Data.StealthObjects.FirstOrDefault(p => p.Position.Distance(pos.To2D()) < float.Epsilon); if (obj != null) Data.StealthObjects.Remove(obj); });
return;
}
default:
{
if (!Data.StealthSpells.Any(p => p.Item2 == args.SData.Name.ToLower()))
return;
level = Data.StealthSpells.First(p => p.Item2 == args.SData.Name.ToLower()).Item1;
}
break;
}
lock (Data.StealthPoses)
Data.StealthPoses.Add(new Tuple<int, Vector3>(Utils.TickCount, pos));
lock (Data.PingPoses)
Data.PingPoses.Add(pos);
List<Vector2> path = sender.GetWaypoints();
var pair = new Tuple<float, List<Vector2>>(path.PathLength() / sender.MoveSpeed, path);
lock (Data.StealthPaths)
Data.StealthPaths.Add(pair);
Utility.DelayAction.Add((int)(path.PathLength() / sender.MoveSpeed * 1000), () => Data.StealthPaths.Remove(pair));
AntiStealth.TryDeStealth(pos, level);
}
});
}