本文整理汇总了C#中SupportPowerManager类的典型用法代码示例。如果您正苦于以下问题:C# SupportPowerManager类的具体用法?C# SupportPowerManager怎么用?C# SupportPowerManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SupportPowerManager类属于命名空间,在下文中一共展示了SupportPowerManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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");
overlayFont = Game.Renderer.Fonts["TinyBold"];
holdOffset = new float2(32,24) - overlayFont.Measure("On Hold") / 2;
readyOffset = new float2(32,24) - overlayFont.Measure("Ready") / 2;
timeOffset = new float2(32,24) - overlayFont.Measure(WidgetUtils.FormatTime(0)) / 2;
}
开发者ID:sonygod,项目名称:OpenRA-Dedicated-20120504,代码行数:20,代码来源:SupportPowersWidget.cs
示例17: Activate
public override void Activate(Actor self, Order order, SupportPowerManager manager)
{
base.Activate(self, order, manager);
var info = Info as ProduceActorPowerInfo;
var sp = self.TraitsImplementing<Production>()
.FirstOrDefault(p => p.Info.Produces.Contains(info.Type));
// TODO: The power should not reset if the production fails.
// Fixing this will require a larger rework of the support power code
var activated = false;
if (sp != null)
foreach (var name in info.Actors)
activated |= sp.Produce(self, self.World.Map.Rules.Actors[name], faction);
if (activated)
Game.Sound.PlayNotification(self.World.Map.Rules, manager.Self.Owner, "Speech", info.ReadyAudio, self.Owner.Faction.InternalName);
else
Game.Sound.PlayNotification(self.World.Map.Rules, manager.Self.Owner, "Speech", info.BlockedAudio, self.Owner.Faction.InternalName);
}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:21,代码来源:ProduceActorPower.cs
示例18: Activate
public override void Activate(Actor self, Order order, SupportPowerManager manager)
{
base.Activate(self, order, manager);
var info = (ParatroopersPowerInfo)Info;
var items = info.DropItems;
var startPos = self.World.ChooseRandomEdgeCell();
self.World.AddFrameEndTask(w =>
{
var flare = info.FlareType != null ? w.CreateActor(info.FlareType, new TypeDictionary
{
new LocationInit( order.TargetLocation ),
new OwnerInit( self.Owner ),
}) : null;
if (flare != null)
{
flare.QueueActivity(new Wait(info.FlareTime));
flare.QueueActivity(new RemoveSelf());
}
var altitude = self.World.Map.Rules.Actors[info.UnitType].Traits.Get<PlaneInfo>().CruiseAltitude;
var a = w.CreateActor(info.UnitType, new TypeDictionary
{
new CenterPositionInit(startPos.CenterPosition + new WVec(WRange.Zero, WRange.Zero, altitude)),
new OwnerInit(self.Owner),
new FacingInit(Util.GetFacing(order.TargetLocation - startPos, 0))
});
a.CancelActivity();
a.QueueActivity(new FlyAttack(Target.FromOrder(order)));
a.Trait<ParaDrop>().SetLZ(order.TargetLocation);
var cargo = a.Trait<Cargo>();
foreach (var i in items)
cargo.Load(a, self.World.CreateActor(false, i.ToLowerInvariant(),
new TypeDictionary { new OwnerInit( a.Owner ) }));
});
}
开发者ID:RunCraze,项目名称:OpenRA,代码行数:40,代码来源:ParatroopersPower.cs
示例19: Activate
public void Activate(Player p)
{
this.p = p;
this.world = p.World;
GameStarted = true;
random = new XRandom((int)p.PlayerActor.ActorID);
SpecialPowers = p.PlayerActor.Trait<SupportPowerManager>();
Power = p.PlayerActor.Trait<PowerManager>();
Resources = p.PlayerActor.Trait<PlayerResources>();
squadmanager = new SquadManager(this);
// Initialize builders
Builders = new List<IAIBuilder>() { new BaseBuilder(this), new DefenseBuilder(this),
new InfantryBuilder(this), new VehicleBuilder(this),
new AircraftBuilder(this), new ShipBuilder(this) };
// Have the bot cheat, gets free 500 000 credits at the start of the match
Resources.GiveCash(500000);
}
开发者ID:Iran,项目名称:ClassicRA,代码行数:22,代码来源:IranAI.cs
示例20: Activate
public override void Activate(Actor self, Order order, SupportPowerManager manager)
{
base.Activate(self, order, manager);
self.World.AddFrameEndTask(w =>
{
Game.Sound.Play(Info.LaunchSound, self.World.Map.CenterOfCell(order.TargetLocation));
w.Add(new IonCannon(self.Owner, info.WeaponInfo, w, order.TargetLocation, info.Effect, info.EffectPalette, info.WeaponDelay));
if (info.CameraActor == null)
return;
var camera = w.CreateActor(info.CameraActor, new TypeDictionary
{
new LocationInit(order.TargetLocation),
new OwnerInit(self.Owner),
});
camera.QueueActivity(new Wait(info.CameraRemoveDelay));
camera.QueueActivity(new RemoveSelf());
});
}
开发者ID:CH4Code,项目名称:OpenRA,代码行数:22,代码来源:IonCannonPower.cs
注:本文中的SupportPowerManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论