本文整理汇总了C#中System.Vector2.HasExtraAvoidDistance方法的典型用法代码示例。如果您正苦于以下问题:C# Vector2.HasExtraAvoidDistance方法的具体用法?C# Vector2.HasExtraAvoidDistance怎么用?C# Vector2.HasExtraAvoidDistance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Vector2
的用法示例。
在下文中一共展示了Vector2.HasExtraAvoidDistance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetBestPositionMovementBlock
public static PositionInfo GetBestPositionMovementBlock(Vector2 movePos)
{
int posChecked = 0;
int maxPosToCheck = 50;
int posRadius = 50;
int radiusIndex = 0;
var extraEvadeDistance = ObjectCache.menuCache.cache["ExtraAvoidDistance"].Cast<Slider>().CurrentValue;
Vector2 heroPoint = ObjectCache.myHeroCache.serverPos2D;
Vector2 lastMovePos = movePos;//Game.CursorPos.To2D(); //movePos
List<PositionInfo> posTable = new List<PositionInfo>();
var extraDist = ObjectCache.menuCache.cache["ExtraCPADistance"].Cast<Slider>().CurrentValue;
var extraDelayBuffer = ObjectCache.menuCache.cache["ExtraPingBuffer"].Cast<Slider>().CurrentValue;
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)));
//if (pos.Distance(myHero.Position.To2D()) < 100)
// dist = 0;
var posInfo = CanHeroWalkToPos(pos, ObjectCache.myHeroCache.moveSpeed, extraDelayBuffer + ObjectCache.gamePing, extraDist);
posInfo.isDangerousPos = pos.CheckDangerousPos(6) || CheckMovePath(pos);
posInfo.distanceToMouse = pos.GetPositionValue();
posInfo.hasExtraDistance = extraEvadeDistance > 0 ? pos.HasExtraAvoidDistance(extraEvadeDistance) : false;
posTable.Add(posInfo);
}
}
var sortedPosTable =
posTable.OrderBy(p => p.isDangerousPos)
.ThenBy(p => p.posDangerLevel)
.ThenBy(p => p.hasExtraDistance)
.ThenBy(p => p.distanceToMouse);
//.ThenBy(p => p.intersectionTime);
foreach (var posInfo in sortedPosTable)
{
if (CheckPathCollision(myHero, posInfo.position) == false)
return posInfo;
}
return null;
}
示例2: GetBestPositionMovementBlock
public static PositionInfo GetBestPositionMovementBlock(Vector2 movePos)
{
int posChecked = 0;
int maxPosToCheck = 50;
int posRadius = 50;
int radiusIndex = 0;
var extraEvadeDistance = ConfigValue.ExtraSpellRadius.GetInt();
Vector2 heroPoint = GameData.HeroInfo.ServerPos2D;
Vector2 lastMovePos = movePos;//Game.CursorPos.To2D(); //movePos
List<PositionInfo> posTable = new List<PositionInfo>();
var extraDist = ConfigValue.ExtraCpaDistance.GetInt();
var extraDelayBuffer = Config.Properties.GetInt(ConfigValue.ExtraPingBuffer);
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)));
//if (pos.Distance(myHero.Position.To2D()) < 100)
// dist = 0;
var posInfo = CanHeroWalkToPos(pos, GameData.HeroInfo.MoveSpeed, extraDelayBuffer + Game.Ping, extraDist);
posInfo.IsDangerousPos = pos.CheckDangerousPos(6) || CheckMovePath(pos);
posInfo.DistanceToMouse = pos.GetPositionValue();
posInfo.HasExtraDistance = extraEvadeDistance > 0 ? pos.HasExtraAvoidDistance(extraEvadeDistance) : false;
posTable.Add(posInfo);
}
}
var sortedPosTable =
posTable.OrderBy(p => p.IsDangerousPos)
.ThenBy(p => p.PosDangerLevel)
.ThenBy(p => p.HasExtraDistance)
.ThenBy(p => p.DistanceToMouse);
//.ThenBy(p => p.intersectionTime);
foreach (var posInfo in sortedPosTable)
{
if (CheckPathCollision(MyHero, posInfo.Position) == true)
return posInfo;
}
return null;
}