本文整理汇总了C#中OpenRA.Traits.Target.IsInRange方法的典型用法代码示例。如果您正苦于以下问题:C# Target.IsInRange方法的具体用法?C# Target.IsInRange怎么用?C# Target.IsInRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenRA.Traits.Target
的用法示例。
在下文中一共展示了Target.IsInRange方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoAttack
public override void DoAttack(Actor self, Target target)
{
if (target.Type != TargetType.Actor || !CanAttack(self, target))
return;
var a = ChooseArmamentForTarget(target);
if (a == null)
return;
if (!target.IsInRange(self.CenterPosition, a.Weapon.Range))
return;
self.CancelActivity();
self.QueueActivity(new Leap(self, target.Actor, a.Weapon, info.Speed, info.Angle));
}
示例2: DoAttack
public override void DoAttack(Actor self, Target target, IEnumerable<Armament> armaments = null)
{
if (target.Type != TargetType.Actor || !CanAttack(self, target))
return;
var a = ChooseArmamentsForTarget(target, true).FirstOrDefault();
if (a == null)
return;
if (!target.IsInRange(self.CenterPosition, a.MaxRange()))
return;
self.CancelActivity();
self.QueueActivity(new Leap(self, target.Actor, a.Weapon, info.Speed, info.Angle));
}
示例3: DoAttack
public override void DoAttack(Actor self, Target target)
{
if (!CanAttack(self, target))
return;
var arm = Armaments.FirstOrDefault();
if (arm == null)
return;
if (!target.IsInRange(self.CenterPosition, arm.Weapon.Range))
return;
foreach (var a in Armaments)
a.CheckFire(self, facing.Value, target);
if (target.Actor != null)
target.Actor.ChangeOwner(self.Owner);
}
示例4: DoAttack
public override void DoAttack(Actor self, Target target, IEnumerable<Armament> armaments = null)
{
// This is so that the worm does not launch an attack against a target that has reached solid rock
if (target.Type != TargetType.Actor || !CanAttack(self, target))
{
self.CancelActivity();
return;
}
var a = ChooseArmamentsForTarget(target, true).FirstOrDefault();
if (a == null)
return;
if (!target.IsInRange(self.CenterPosition, a.MaxRange()))
return;
self.CancelActivity();
self.QueueActivity(new SwallowActor(self, target, a.Weapon));
}
示例5: DoAttack
public override void DoAttack(Actor self, Target target)
{
if (!CanAttack(self, target)) return;
var arm = Armaments.FirstOrDefault();
if (arm == null)
return;
// TODO: Define weapon ranges as WRange
var range = new WRange((int)(1024*arm.Weapon.Range));
if (!target.IsInRange(self.CenterPosition, range))
return;
var facing = self.TraitOrDefault<IFacing>();
foreach (var a in Armaments)
a.CheckFire(self, this, facing, target);
if (target.Actor != null)
target.Actor.ChangeOwner(self.Owner);
}
示例6: CanTargetActor
bool CanTargetActor(Actor self, Target target, TargetModifiers modifiers, ref string cursor)
{
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
var a = ab.ChooseArmamentForTarget(target);
cursor = a != null && !target.IsInRange(self.CenterPosition, a.Weapon.Range)
? ab.info.OutsideRangeCursor
: ab.info.Cursor;
if (target.Type == TargetType.Actor && target.Actor == self)
return false;
if (!ab.HasAnyValidWeapons(target))
return false;
if (modifiers.HasModifier(TargetModifiers.ForceAttack))
return true;
if (modifiers.HasModifier(TargetModifiers.ForceMove))
return false;
if (target.RequiresForceFire)
return false;
var targetableRelationship = negativeDamage ? Stance.Ally : Stance.Enemy;
var owner = target.Type == TargetType.FrozenActor ? target.FrozenActor.Owner : target.Actor.Owner;
return self.Owner.Stances[owner] == targetableRelationship;
}
示例7: IsReachableTarget
public bool IsReachableTarget(Target target, bool allowMove)
{
return HasAnyValidWeapons(target)
&& (target.IsInRange(self.CenterPosition, GetMaximumRange()) || (allowMove && self.HasTrait<IMove>()));
}