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


C# SupportPowerManager类代码示例

本文整理汇总了C#中SupportPowerManager的典型用法代码示例。如果您正苦于以下问题:C# SupportPowerManager类的具体用法?C# SupportPowerManager怎么用?C# SupportPowerManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Activate

		public override void Activate(Actor self, Order order, SupportPowerManager manager)
		{
			base.Activate(self, order, manager);

			var wsb = self.TraitOrDefault<WithSpriteBody>();
			if (wsb != null && wsb.DefaultAnimation.HasSequence(info.GrantUpgradeSequence))
				wsb.PlayCustomAnimation(self, info.GrantUpgradeSequence);

			Game.Sound.Play(info.GrantUpgradeSound, self.World.Map.CenterOfCell(order.TargetLocation));

			foreach (var a in UnitsInRange(order.TargetLocation))
			{
				var um = a.TraitOrDefault<UpgradeManager>();
				if (um == null)
					continue;

				foreach (var u in info.Upgrades)
				{
					if (info.Duration > 0)
					{
						if (um.AcknowledgesUpgrade(a, u))
							um.GrantTimedUpgrade(a, u, info.Duration);
					}
					else
					{
						if (um.AcceptsUpgrade(a, u))
							um.GrantUpgrade(a, u, this);
					}
				}
			}
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:31,代码来源:GrantUpgradePower.cs

示例2: Activate

        public override void Activate(Actor self, Order order, SupportPowerManager manager)
        {
            base.Activate(self, order, manager);

            var info = Info as SpawnActorPowerInfo;

            if (info.Actor != null)
            {
                self.World.AddFrameEndTask(w =>
                {
                    var location = self.World.Map.CenterOfCell(order.TargetLocation);

                    Game.Sound.Play(info.DeploySound, location);

                    if (!string.IsNullOrEmpty(info.EffectSequence) && !string.IsNullOrEmpty(info.EffectPalette))
                        w.Add(new SpriteEffect(location, w, info.EffectImage, info.EffectSequence, info.EffectPalette));

                    var actor = w.CreateActor(info.Actor, new TypeDictionary
                    {
                        new LocationInit(order.TargetLocation),
                        new OwnerInit(self.Owner),
                    });

                    if (info.LifeTime > -1)
                    {
                        actor.QueueActivity(new Wait(info.LifeTime));
                        actor.QueueActivity(new RemoveSelf());
                    }
                });
            }
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:31,代码来源:SpawnActorPower.cs

示例3: Activate

        public override void Activate(Actor self, Order order, SupportPowerManager manager)
        {
            base.Activate(self, order, manager);

            var enterCell = self.World.ChooseRandomEdgeCell();
            var altitude = self.World.Map.Rules.Actors["u2"].Traits.Get<PlaneInfo>().CruiseAltitude;

            var plane = self.World.CreateActor("u2", new TypeDictionary
            {
                new CenterPositionInit(enterCell.CenterPosition + new WVec(WRange.Zero, WRange.Zero, altitude)),
                new OwnerInit(self.Owner),
                new FacingInit(Util.GetFacing(order.TargetLocation - enterCell, 0))
            });

            plane.CancelActivity();
            plane.QueueActivity(new Fly(plane, Target.FromCell(order.TargetLocation)));
            plane.QueueActivity(new CallFunc(() => plane.World.AddFrameEndTask( w =>
                {
                    var camera = w.CreateActor("camera", new TypeDictionary
                    {
                        new LocationInit( order.TargetLocation ),
                        new OwnerInit( self.Owner ),
                    });

                    camera.QueueActivity(new Wait(25 * ((SpyPlanePowerInfo)Info).RevealTime));
                    camera.QueueActivity(new RemoveSelf());
                })));
            plane.QueueActivity(new FlyOffMap());
            plane.QueueActivity(new RemoveSelf());
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:30,代码来源:SpyPlanePower.cs

示例4: Activate

        public override void Activate(Actor self, Order order, SupportPowerManager manager)
        {
            base.Activate(self, order, manager);

            self.Trait<RenderBuilding>().PlayCustomAnim(self, "active");

            Sound.Play(info.GrantUpgradeSound, self.World.Map.CenterOfCell(order.TargetLocation));

            foreach (var a in UnitsInRange(order.TargetLocation))
            {
                var um = a.TraitOrDefault<UpgradeManager>();
                if (um == null)
                    continue;

                foreach (var u in info.Upgrades)
                {
                    if (info.Duration > 0)
                    {
                        if (um.AcknowledgesUpgrade(a, u))
                            um.GrantTimedUpgrade(a, u, info.Duration);
                    }
                    else
                    {
                        if (um.AcceptsUpgrade(a, u))
                            um.GrantUpgrade(a, u, this);
                    }
                }
            }
        }
开发者ID:rhamilton1415,项目名称:OpenRA,代码行数:29,代码来源:GrantUpgradePower.cs

示例5: SelectTarget

 public SelectTarget(string order, SupportPowerManager manager, IronCurtainPower power)
 {
     this.manager = manager;
     this.order = order;
     this.power = power;
     this.range = (power.Info as IronCurtainPowerInfo).Range;
     tile = SequenceProvider.GetSequence("overlay", "target-select").GetSprite(0);
 }
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:8,代码来源:IronCurtainPower.cs

示例6: Activate

        public override void Activate(Actor self, Order order, SupportPowerManager manager)
        {
            base.Activate(self, order, manager);

            // TODO: Reveal submarines

            // Should this play for all players?
            Sound.Play("sonpulse.aud");
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:9,代码来源:SonarPulsePower.cs

示例7: OrderGenerator

        public override IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
        {
            // Clear selection if using Left-Click Orders
            if (Game.Settings.Game.UseClassicMouseStyle)
                manager.Self.World.Selection.Clear();

            Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound);
            var info = Info as IonCannonPowerInfo;
            return new SelectGenericPowerTarget(order, manager, info.Cursor, MouseButton.Left);
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:10,代码来源:IonCannonPower.cs

示例8: SupportPowersWidget

		public SupportPowersWidget(World world, WorldRenderer worldRenderer)
		{
			this.worldRenderer = worldRenderer;
			spm = world.LocalPlayer.PlayerActor.Trait<SupportPowerManager>();
			tooltipContainer = Exts.Lazy(() =>
				Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));

			icon = new Animation(world, "icon");
			clock = new Animation(world, ClockAnimation);
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:10,代码来源:SupportPowersWidget.cs

示例9: Activate

 public virtual void Activate(Actor self, Order order, SupportPowerManager manager)
 {
     if (Info.DisplayRadarPing && manager.RadarPings != null)
     {
         ping = manager.RadarPings.Value.Add(
             () => order.Player.IsAlliedWith(self.World.RenderPlayer),
             order.TargetLocation.CenterPosition,
             order.Player.Color.RGB,
             Info.RadarPingDuration);
     }
 }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:11,代码来源:SupportPower.cs

示例10: Activate

		public override void Activate(Actor self, Order order, SupportPowerManager manager)
		{
			base.Activate(self, order, manager);

			self.Trait<RenderBuilding>().PlayCustomAnim(self, "active");

			Sound.Play(info.IronCurtainSound, self.World.Map.CenterOfCell(order.TargetLocation));

			foreach (var target in UnitsInRange(order.TargetLocation)
				.Where(a => a.Owner.Stances[self.Owner] == Stance.Ally))
				target.Trait<IronCurtainable>().Activate(target, ((IronCurtainPowerInfo)Info).Duration * 25);
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:12,代码来源:IronCurtainPower.cs

示例11: Activate

        public override void Activate(Actor self, Order order, SupportPowerManager manager)
        {
            base.Activate(self, order, manager);

            self.World.AddFrameEndTask(w =>
            {
                Game.Sound.PlayToPlayer(SoundType.World, self.Owner, Info.LaunchSound);
                Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech",
                    Info.LaunchSpeechNotification, self.Owner.Faction.InternalName);

                w.Add(new SatelliteLaunch(self, info));
            });
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:13,代码来源:GpsPower.cs

示例12: Activate

        public override void Activate(Actor self, Order order, SupportPowerManager manager)
        {
            base.Activate(self, order, manager);

            self.World.AddFrameEndTask(w =>
            {
                Sound.PlayToPlayer(self.Owner, Info.LaunchSound);

                w.Add(new SatelliteLaunch(self));

                owner.Launch(self, Info);
            });
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:13,代码来源:GpsPower.cs

示例13: Activate

        public override void Activate(Actor self, Order order, SupportPowerManager manager)
        {
            base.Activate(self, order, manager);

            foreach (var target in UnitsInRange(order.ExtraLocation))
            {
                var cs = target.Trait<Chronoshiftable>();
                var targetCell = target.Location + (order.TargetLocation - order.ExtraLocation);
                var cpi = Info as ChronoshiftPowerInfo;

                if (self.Owner.Shroud.IsExplored(targetCell) && cs.CanChronoshiftTo(target, targetCell))
                    cs.Teleport(target, targetCell, cpi.Duration * 25, cpi.KillCargo, self);
            }
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:14,代码来源:ChronoshiftPower.cs

示例14: SupportPowersWidget

        public SupportPowersWidget(World world, WorldRenderer worldRenderer)
        {
            this.worldRenderer = worldRenderer;
            spm = world.LocalPlayer.PlayerActor.Trait<SupportPowerManager>();
            tooltipContainer = Lazy.New(() =>
                Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));

            iconSprites = Rules.Info.Values.SelectMany( u => u.Traits.WithInterface<SupportPowerInfo>() )
                .Select(u => u.Image).Distinct()
                .ToDictionary(
                    u => u,
                    u => Game.modData.SpriteLoader.LoadAllSprites(u)[0]);

            clock = new Animation("clock");
        }
开发者ID:nevelis,项目名称:OpenRA,代码行数:15,代码来源:SupportPowersWidget.cs

示例15: Activate

        public override void Activate(Actor self, Order order, SupportPowerManager manager)
        {
            base.Activate(self, order, manager);

            var wsb = self.TraitOrDefault<WithSpriteBody>();
            if (wsb != null && wsb.DefaultAnimation.HasSequence(info.Sequence))
                wsb.PlayCustomAnimation(self, info.Sequence, () => wsb.CancelCustomAnimation(self));

            Game.Sound.Play(SoundType.World, info.OnFireSound, self.World.Map.CenterOfCell(order.TargetLocation));

            foreach (var a in UnitsInRange(order.TargetLocation))
            {
                var um = a.TraitOrDefault<UpgradeManager>();

                // Condition token is ignored because we never revoke this condition.
                if (um != null)
                    um.GrantCondition(a, info.Condition, true, info.Duration);
            }
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:19,代码来源:GrantExternalConditionPower.cs


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