本文整理汇总了C#中WoWPoint.DistanceSqr方法的典型用法代码示例。如果您正苦于以下问题:C# WoWPoint.DistanceSqr方法的具体用法?C# WoWPoint.DistanceSqr怎么用?C# WoWPoint.DistanceSqr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WoWPoint
的用法示例。
在下文中一共展示了WoWPoint.DistanceSqr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBehavior
protected override Composite CreateBehavior()
{
return _root ?? (_root = new PrioritySelector(
// if not in a turret than move to one and interact with it
new Decorator(ret => !InVehicle,
new Sequence(ctx => GetMustang(), // set Turret as context
new DecoratorContinue(ctx => ctx != null && ((WoWUnit)ctx).DistanceSqr > 5 * 5,
new Action(ctx =>
{
Navigator.MoveTo(((WoWUnit)ctx).Location);
TreeRoot.StatusText = "Moving To Mustang";
})),
new DecoratorContinue(ctx => ctx != null && ((WoWUnit)ctx).DistanceSqr <= 5 * 5,
new Action(ctx =>
{
Logging.Write("Interacting with Mustang");
if (Me.Mounted)
Mount.Dismount();
((WoWUnit)ctx).Interact();
})))),
// Find the nearest spider and if none exist then move to thier spawn location
new Decorator(ret => _currentTarget == null || !_currentTarget.IsValid || !_currentTarget.IsAlive,
new Action(ctx =>
{
_currentTarget = ObjectManager.GetObjectsOfType<WoWUnit>()
.Where(
u =>
u.IsAlive && !_blackList.Contains(u.Guid) && u.Entry == 44284).
OrderBy(u => u.DistanceSqr).FirstOrDefault();
if (_currentTarget == null)
{
Navigator.MoveTo(_spiderLocation);
Logging.Write("No spiders found. Moving to spawn point");
}
else
{
_movetoPoint = WoWMathHelper.CalculatePointFrom(_lumberMillLocation,
_currentTarget.
Location, -5);
Logging.Write("Locked on a new target. Distance {0}", _currentTarget.Distance);
}
})),
new Sequence(
new Action(ctx => TreeRoot.StatusText = "Scaring spider towards lumber mill"),
new Action(ctx =>
{ // blacklist spider if it doesn't move
if (DateTime.Now - _stuckTimeStamp > TimeSpan.FromSeconds(6))
{
_stuckTimeStamp = DateTime.Now;
if (_movetoPoint.DistanceSqr(_lastMovetoPoint) < 3 * 3)
{
Logging.Write("Blacklisting spider");
_blackList.Add(_currentTarget.Guid);
_currentTarget = null;
return RunStatus.Failure;
}
_lastMovetoPoint = _movetoPoint;
}
return RunStatus.Success;
}),
new Action(ctx =>
{
// update movepoint
_movetoPoint =
WoWMathHelper.CalculatePointFrom(_lumberMillLocation,
_currentTarget.
Location, -7);
if (_movetoPoint.DistanceSqr(Me.Location) >8 * 8)
{
Navigator.MoveTo(_movetoPoint);
return RunStatus.Running;
}
return RunStatus.Success;
}),
new WaitContinue(2, ret => !Me.IsMoving, new ActionAlwaysSucceed()),
new Action(ctx =>
{
using (new FrameLock())
{
Me.SetFacing(_lumberMillLocation);
WoWMovement.Move(WoWMovement.MovementDirection.ForwardBackMovement);
WoWMovement.MoveStop(WoWMovement.MovementDirection.ForwardBackMovement);
//Lua.DoString("CastSpellByID(83605)");
}
}),
new WaitContinue(TimeSpan.FromMilliseconds(200), ret => false, new ActionAlwaysSucceed()),
new Action(ctx => Lua.DoString("CastSpellByID(83605)"))
/*
new Action(ctx =>
{
var unit = ctx as WoWUnit;
if (unit != null && unit.IsValid && unit.IsAlive)
{
// move to a point that places the spider between player and lumber mill
var movetoPoint = WoWMathHelper.CalculatePointFrom(_lumberMillLocation, unit.Location, -5);
// blacklist spider if its not moving
if (DateTime.Now - _stuckTimeStamp > TimeSpan.FromSeconds(6))
{
//.........这里部分代码省略.........