当前位置: 首页>>代码示例>>C#>>正文


C# Target.IsInRange方法代码示例

本文整理汇总了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));
        }
开发者ID:rhamilton1415,项目名称:OpenRA,代码行数:15,代码来源:AttackLeap.cs

示例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));
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:15,代码来源:AttackLeap.cs

示例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);
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:18,代码来源:AttackLoyalty.cs

示例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));
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:19,代码来源:AttackSwallow.cs

示例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);
        }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:20,代码来源:AttackLoyalty.cs

示例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;
			}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:29,代码来源:AttackBase.cs

示例7: IsReachableTarget

		public bool IsReachableTarget(Target target, bool allowMove)
		{
			return HasAnyValidWeapons(target)
				&& (target.IsInRange(self.CenterPosition, GetMaximumRange()) || (allowMove && self.HasTrait<IMove>()));
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:5,代码来源:AttackBase.cs


注:本文中的OpenRA.Traits.Target.IsInRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。