本文整理汇总了C#中Spell.GetCurrentSpellPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Spell.GetCurrentSpellPosition方法的具体用法?C# Spell.GetCurrentSpellPosition怎么用?C# Spell.GetCurrentSpellPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spell
的用法示例。
在下文中一共展示了Spell.GetCurrentSpellPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetClosestDistanceApproach
public static float GetClosestDistanceApproach(Spell spell, Vector2 pos, float speed, float delay, Vector2 heroPos, float extraDist)
{
var walkDir = (pos - heroPos).Normalized();
if (spell.spellType == SpellType.Line && spell.info.projectileSpeed != float.MaxValue)
{
var spellPos = spell.GetCurrentSpellPosition(true, delay);
var spellStartPos = spell.currentSpellPosition;
var spellEndPos = spell.GetSpellEndPosition();
var extendedPos = pos.ExtendDir(walkDir, ObjectCache.myHeroCache.boundingRadius + speed * delay / 1000);
Vector2 cHeroPos;
Vector2 cSpellPos;
var cpa2 = MathUtils.GetCollisionDistanceEx(
heroPos, walkDir * speed, ObjectCache.myHeroCache.boundingRadius,
spellPos, spell.direction * spell.info.projectileSpeed, spell.radius + extraDist,
out cHeroPos, out cSpellPos);
var cHeroPosProjection = cHeroPos.ProjectOn(heroPos, extendedPos);
var cSpellPosProjection = cSpellPos.ProjectOn(spellPos, spellEndPos);
if (cSpellPosProjection.IsOnSegment && cHeroPosProjection.IsOnSegment && cpa2 != float.MaxValue)
{
return 0;
}
var cpa = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cHeroPos, out cSpellPos);
cHeroPosProjection = cHeroPos.ProjectOn(heroPos, extendedPos);
cSpellPosProjection = cSpellPos.ProjectOn(spellPos, spellEndPos);
var checkDist = ObjectCache.myHeroCache.boundingRadius + spell.radius + extraDist;
if (cSpellPosProjection.IsOnSegment && cHeroPosProjection.IsOnSegment)
{
return Math.Max(0, cpa - checkDist);
}
else
{
return checkDist;
}
//return MathUtils.ClosestTimeOfApproach(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed);
}
else if (spell.spellType == SpellType.Line && spell.info.projectileSpeed == float.MaxValue)
{
var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay); //extraDelay
var walkRange = heroPos.Distance(pos);
var predictedRange = speed * (spellHitTime / 1000);
var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos
var projection = tHeroPos.ProjectOn(spell.startPos, spell.endPos);
return Math.Max(0, tHeroPos.Distance(projection.SegmentPoint)
- (spell.radius + ObjectCache.myHeroCache.boundingRadius + extraDist)); //+ dodgeBuffer
}
else if (spell.spellType == SpellType.Circular)
{
var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay); //extraDelay
var walkRange = heroPos.Distance(pos);
var predictedRange = speed * (spellHitTime / 1000);
var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos
if (spell.info.spellName == "VeigarEventHorizon")
{
var wallRadius = 65;
var midRadius = spell.radius - wallRadius;
if (spellHitTime == 0)
{
return 0;
}
if (tHeroPos.Distance(spell.endPos) >= spell.radius)
{
return Math.Max(0, tHeroPos.Distance(spell.endPos) - midRadius - wallRadius);
}
else
{
return Math.Max(0, midRadius - tHeroPos.Distance(spell.endPos) - wallRadius);
}
}
var closestDist = Math.Max(0, tHeroPos.Distance(spell.endPos) - (spell.radius + extraDist));
if (spell.info.extraEndTime > 0 && closestDist != 0)
{
var remainingTime = Math.Max(0, spell.endTime + spell.info.extraEndTime - EvadeUtils.TickCount - delay);
var predictedRange2 = speed * (remainingTime / 1000);
var tHeroPos2 = heroPos + walkDir * Math.Min(predictedRange2, walkRange);
if (CheckMoveToDirection(tHeroPos, tHeroPos2))
{
return 0;
}
}
else
{
return closestDist;
}
//.........这里部分代码省略.........
示例2: GetClosestDistanceApproach
public static float GetClosestDistanceApproach(Spell spell, Vector2 pos, float speed, float delay, Vector2 heroPos, float extraDist)
{
var walkDir = (pos - heroPos).Normalized();
var zVector = new Vector2(0, 0);
heroPos = heroPos - walkDir * speed * ((float)ObjectCache.gamePing) / 1000;
if (spell.info.spellType == SpellType.Line && spell.info.projectileSpeed != float.MaxValue)
{
var spellPos = spell.GetCurrentSpellPosition(true, delay);
var spellEndPos = spell.GetSpellEndPosition();
Vector2 cSpellPos;
Vector2 cHeroPos;
var cpa = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cSpellPos, out cHeroPos);
var spellPos2 = spell.currentNegativePosition;
Vector2 cSpellPos2;
Vector2 cHeroPos2;
var cpa2 = MathUtilsCPA.CPAPointsEx(heroPos, walkDir * speed, spellPos2, spell.direction * spell.info.projectileSpeed, pos, spellEndPos, out cSpellPos2, out cHeroPos2);
var cHeroPosProjection = cHeroPos.ProjectOn(cSpellPos2, cSpellPos); //from predicted
var checkDist = ObjectCache.myHeroCache.boundingRadius + spell.radius + extraDist;
if (cHeroPosProjection.IsOnSegment)
{
if (cHeroPosProjection.SegmentPoint.Distance(cHeroPos) <= checkDist)
{
return 0;
}
}
if (cpa <= checkDist || cpa2 <= checkDist)
{
return 0;
}
return Math.Min(Math.Max(0, cpa - checkDist), Math.Max(0, cpa2 - checkDist));
//return MathUtils.ClosestTimeOfApproach(heroPos, walkDir * speed, spellPos, spell.direction * spell.info.projectileSpeed);
}
else if (spell.info.spellType == SpellType.Line && spell.info.projectileSpeed == float.MaxValue)
{
var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay); //extraDelay
var walkRange = heroPos.Distance(pos);
var predictedRange = speed * (spellHitTime / 1000);
var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos
var projection = tHeroPos.ProjectOn(spell.startPos, spell.endPos);
return Math.Max(0, tHeroPos.Distance(projection.SegmentPoint)
- (spell.radius + ObjectCache.myHeroCache.boundingRadius + extraDist)); //+ dodgeBuffer
}
else if (spell.info.spellType == SpellType.Circular)
{
var spellHitTime = Math.Max(0, spell.endTime - EvadeUtils.TickCount - delay); //extraDelay
var walkRange = heroPos.Distance(pos);
var predictedRange = speed * (spellHitTime / 1000);
var tHeroPos = heroPos + walkDir * Math.Min(predictedRange, walkRange); //Hero predicted pos
return Math.Max(0, tHeroPos.Distance(spell.endPos) - (spell.radius + extraDist)); //+ dodgeBuffer
}
return 1;
}