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


C# TargetModifiers.HasModifier方法代码示例

本文整理汇总了C#中TargetModifiers.HasModifier方法的典型用法代码示例。如果您正苦于以下问题:C# TargetModifiers.HasModifier方法的具体用法?C# TargetModifiers.HasModifier怎么用?C# TargetModifiers.HasModifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TargetModifiers的用法示例。


在下文中一共展示了TargetModifiers.HasModifier方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CanTarget

		public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
		{
			var type = target.Type;
			if (type != TargetType.Actor && type != TargetType.FrozenActor)
				return false;

			cursor = this.cursor;
			IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);

			if (ForceAttack != null && modifiers.HasModifier(TargetModifiers.ForceAttack) != ForceAttack)
				return false;

			var owner = type == TargetType.FrozenActor ? target.FrozenActor.Owner : target.Actor.Owner;
			var playerRelationship = self.Owner.Stances[owner];

			if (!modifiers.HasModifier(TargetModifiers.ForceAttack) && playerRelationship == Stance.Ally && !targetAllyUnits)
				return false;

			if (!modifiers.HasModifier(TargetModifiers.ForceAttack) && playerRelationship == Stance.Enemy && !targetEnemyUnits)
				return false;

			return type == TargetType.FrozenActor ?
				CanTargetFrozenActor(self, target.FrozenActor, modifiers, ref cursor) :
				CanTargetActor(self, target.Actor, modifiers, ref cursor);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:25,代码来源:UnitOrderTargeter.cs

示例2: CanTarget

        public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
        {
            if (target.Type != TargetType.Actor)
                return false;

            IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
            cursor = this.cursor();

            return self == target.Actor;
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:10,代码来源:DeployOrderTargeter.cs

示例3: CanTarget

		public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
		{
			if (target.Type != TargetType.Actor)
				return false;

			IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
			cursor = useDeployCursor() ? "deploy" : "deploy-blocked";

			return self == target.Actor;
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:10,代码来源:DeployOrderTargeter.cs

示例4: CanTarget

		public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
		{
			if (target.Type != TargetType.Terrain)
				return false;

			var location = self.World.Map.CellContaining(target.CenterPosition);
			var explored = self.Owner.Shroud.IsExplored(location);
			cursor = self.World.Map.Contains(location) ?
				(self.World.Map.GetTerrainInfo(location).CustomCursor ?? "move") :
				"move-blocked";

			IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);

			if (!explored && !info.MoveIntoShroud)
				cursor = "move-blocked";

			return true;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:18,代码来源:AircraftMoveOrderTargeter.cs

示例5: CanTargetActor

            public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
            {
                var hut = target.TraitOrDefault<BridgeHut>();
                if (hut == null)
                    return false;

                // Require force attack to heal partially damaged bridges to avoid unnecessary cursor noise
                var damage = hut.BridgeDamageState;
                if (!modifiers.HasModifier(TargetModifiers.ForceAttack) && damage != DamageState.Dead)
                    return false;

                // Obey force moving onto bridges
                if (modifiers.HasModifier(TargetModifiers.ForceMove))
                    return false;

                // Can't repair a bridge that is undamaged, already under repair, or dangling
                if (damage == DamageState.Undamaged || hut.Repairing || hut.Bridge.IsDangling)
                    cursor = info.TargetBlockedCursor;

                return true;
            }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:21,代码来源:RepairsBridges.cs

示例6: CanTarget

            public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
            {
                if (target.Type != TargetType.Terrain)
                    return false;

                var location = self.World.Map.CellContaining(target.CenterPosition);
                if (!self.World.Map.Contains(location))
                    return false;

                cursor = "ability";
                IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);

                return !othersAtTarget.Any() && modifiers.HasModifier(TargetModifiers.ForceAttack);
            }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:14,代码来源:Minelayer.cs

示例7: CanTarget

            public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
            {
                if (target.Type != TargetType.Terrain)
                    return false;

                if (modifiers.HasModifier(TargetModifiers.ForceMove))
                    return false;

                var location = self.World.Map.CellContaining(target.CenterPosition);
                // Don't leak info about resources under the shroud
                if (!self.Owner.Shroud.IsExplored(location))
                    return false;

                var res = self.World.WorldActor.Trait<ResourceLayer>().GetRenderedResource(location);
                var info = self.Info.Traits.Get<HarvesterInfo>();

                if (res == null || !info.Resources.Contains(res.Info.Name))
                    return false;

                cursor = "harvest";
                IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);

                return true;
            }
开发者ID:RobotCaleb,项目名称:OpenRA,代码行数:24,代码来源:Harvester.cs

示例8: CanTargetLocation

			bool CanTargetLocation(Actor self, CPos location, List<Actor> actorsAtLocation, TargetModifiers modifiers, ref string cursor)
			{
				if (!self.World.Map.Contains(location))
					return false;

				IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);

				cursor = ab.info.Cursor;

				if (negativeDamage)
					return false;

				if (!ab.HasAnyValidWeapons(Target.FromCell(self.World, location)))
					return false;

				if (modifiers.HasModifier(TargetModifiers.ForceAttack))
				{
					var maxRange = ab.GetMaximumRange().Range;
					var targetRange = (self.World.Map.CenterOfCell(location) - self.CenterPosition).HorizontalLengthSquared;
					if (targetRange > maxRange * maxRange)
						cursor = ab.info.OutsideRangeCursor;

					return true;
				}

				return false;
			}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:27,代码来源:AttackBase.cs

示例9: 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

示例10: CanTargetActor

            public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
            {
                // Obey force moving onto bridges
                if (modifiers.HasModifier(TargetModifiers.ForceMove))
                    return false;

                return target.TraitsImplementing<IDemolishable>().Any(i => i.IsValidTarget(target, self));
            }
开发者ID:ushardul,项目名称:OpenRA,代码行数:8,代码来源:C4Demolition.cs

示例11: CanTarget

        public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, ref TargetModifiers modifiers, ref string cursor)
        {
            // TODO: When target modifiers are configurable this needs to be revisited
            if (modifiers.HasModifier(TargetModifiers.ForceMove) || modifiers.HasModifier(TargetModifiers.ForceQueue))
            {
                var xy = self.World.Map.CellContaining(target.CenterPosition);

                IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);

                if (self.IsInWorld && self.Owner.Shroud.IsExplored(xy))
                {
                    cursor = targetCursor;
                    return true;
                }

                return false;
            }

            return false;
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:20,代码来源:PortableChrono.cs

示例12: TargetOverridesSelection

 public bool TargetOverridesSelection(TargetModifiers modifiers)
 {
     return modifiers.HasModifier(TargetModifiers.ForceMove);
 }
开发者ID:pchote,项目名称:OpenRA,代码行数:4,代码来源:AircraftMoveOrderTargeter.cs

示例13: CanTargetLocation

            bool CanTargetLocation(Actor self, CPos location, List<Actor> actorsAtLocation, TargetModifiers modifiers, ref string cursor)
            {
                if (!self.World.Map.IsInMap(location))
                    return false;

                IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);

                cursor = self.Info.Traits.Get<AttackBaseInfo>().Cursor;

                if (negativeDamage)
                    return false;

                if (!self.Trait<AttackBase>().HasAnyValidWeapons(Target.FromCell(location)))
                    return false;

                if (modifiers.HasModifier(TargetModifiers.ForceAttack))
                    return true;

                return false;
            }
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:20,代码来源:AttackBase.cs

示例14: CanTargetActor

            bool CanTargetActor(Actor self, Target target, TargetModifiers modifiers, ref string cursor)
            {
                IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);

                cursor = self.Info.Traits.Get<AttackBaseInfo>().Cursor;

                if (target.Type == TargetType.Actor && target.Actor == self)
                    return false;

                if (!self.Trait<AttackBase>().HasAnyValidWeapons(target))
                    return false;

                if (modifiers.HasModifier(TargetModifiers.ForceAttack))
                    return true;

                if (modifiers.HasModifier(TargetModifiers.ForceMove))
                    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:Generalcamo,项目名称:OpenRA,代码行数:23,代码来源:AttackBase.cs

示例15: CanTargetActor

            public override bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor)
            {
                // Obey force moving onto bridges
                if (modifiers.HasModifier(TargetModifiers.ForceMove))
                    return false;

                var demolishable = target.TraitOrDefault<IDemolishable>();
                if (demolishable == null || !demolishable.IsValidTarget(target, self))
                    return false;

                return true;
            }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:12,代码来源:C4Demolition.cs


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