本文整理汇总了C#中Actor类的典型用法代码示例。如果您正苦于以下问题:C# Actor类的具体用法?C# Actor怎么用?C# Actor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Actor类属于命名空间,在下文中一共展示了Actor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DoImpact
public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
{
if (!target.IsValidFor(firedBy))
return;
var pos = target.CenterPosition;
var world = firedBy.World;
var targetTile = world.Map.CellContaining(pos);
var isValid = IsValidImpact(pos, firedBy);
if ((!world.Map.Contains(targetTile)) || (!isValid))
return;
var palette = ExplosionPalette;
if (UsePlayerPalette)
palette += firedBy.Owner.InternalName;
var explosion = Explosions.RandomOrDefault(Game.CosmeticRandom);
if (Image != null && explosion != null)
world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, w, Image, explosion, palette)));
var impactSound = ImpactSounds.RandomOrDefault(Game.CosmeticRandom);
if (impactSound != null)
Game.Sound.Play(impactSound, pos);
}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:25,代码来源:CreateEffectWarhead.cs
示例2: 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
示例3: DrawCostume
public int DrawCostume(VirtScreen vs, int numStrips, Actor actor, bool drawToBackBuf)
{
var pixelsNavigator = new PixelNavigator(vs.Surfaces[drawToBackBuf ? 1 : 0]);
pixelsNavigator.OffsetX(vs.XStart);
ActorX += (vs.XStart & 7);
_w = vs.Width;
_h = vs.Height;
pixelsNavigator.OffsetX(-(vs.XStart & 7));
startNav = new PixelNavigator(pixelsNavigator);
if (_vm.Game.Version <= 1)
{
_xmove = 0;
_ymove = 0;
}
else if (_vm.Game.IsOldBundle)
{
_xmove = -72;
_ymove = -100;
}
else
{
_xmove = _ymove = 0;
}
int result = 0;
for (int i = 0; i < 16; i++)
result |= DrawLimb(actor, i);
return result;
}
开发者ID:scemino,项目名称:nscumm,代码行数:31,代码来源:BaseCostumeRenderer.cs
示例4: Activate
public override void Activate(Actor self, Order order)
{
// TODO: Reveal submarines
// Should this play for all players?
Sound.Play("sonpulse.aud");
}
开发者ID:Iran,项目名称:ClassicRA,代码行数:7,代码来源:SonarPulsePower.cs
示例5: UnloadCargo
public UnloadCargo(Actor self, bool unloadAll)
{
this.self = self;
cargo = self.Trait<Cargo>();
cloak = self.TraitOrDefault<Cloak>();
this.unloadAll = unloadAll;
}
开发者ID:Flamewh33l,项目名称:OpenRA,代码行数:7,代码来源:UnloadCargo.cs
示例6: Activate
public override void Activate(Actor collector)
{
var actorsInRange = self.World.FindActorsInCircle(self.CenterPosition, info.Range)
.Where(a => a != self && a != collector && a.Owner == collector.Owner && AcceptsUpgrade(a));
if (info.MaxExtraCollectors > -1)
actorsInRange = actorsInRange.Take(info.MaxExtraCollectors);
collector.World.AddFrameEndTask(w =>
{
foreach (var a in actorsInRange.Append(collector))
{
if (!a.IsInWorld || a.IsDead)
continue;
var um = a.TraitOrDefault<UpgradeManager>();
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);
}
}
}
});
base.Activate(collector);
}
开发者ID:CH4Code,项目名称:OpenRA,代码行数:34,代码来源:GrantUpgradeCrateAction.cs
示例7: ShroudPalette
public ShroudPalette(Actor self, ShroudPaletteInfo info)
{
// TODO: This shouldn't rely on a base palette
var wr = self.World.WorldRenderer;
var pal = wr.GetPalette("terrain");
wr.AddPalette(info.Name, new Palette(pal, new ShroudPaletteRemap(info.IsFog)));
}
开发者ID:comradpara,项目名称:OpenRA,代码行数:7,代码来源:ShroudPalette.cs
示例8: FallToEarth
public FallToEarth(Actor self, FallsToEarthInfo info)
{
this.info = info;
aircraft = self.Trait<Aircraft>();
if (info.Spins)
acceleration = self.World.SharedRandom.Next(2) * 2 - 1;
}
开发者ID:CH4Code,项目名称:OpenRA,代码行数:7,代码来源:FallToEarth.cs
示例9: Tick
public override Activity Tick(Actor self)
{
if (self.World.Map.DistanceAboveTerrain(self.CenterPosition).Length <= 0)
{
if (info.ExplosionWeapon != null)
{
// Use .FromPos since this actor is killed. Cannot use Target.FromActor
info.ExplosionWeapon.Impact(Target.FromPos(self.CenterPosition), self, Enumerable.Empty<int>());
}
self.Dispose();
return null;
}
if (info.Spins)
{
spin += acceleration;
aircraft.Facing = (aircraft.Facing + spin) % 256;
}
var move = info.Moves ? aircraft.FlyStep(aircraft.Facing) : WVec.Zero;
move -= new WVec(WDist.Zero, WDist.Zero, info.Velocity);
aircraft.SetPosition(self, aircraft.CenterPosition + move);
return this;
}
开发者ID:CH4Code,项目名称:OpenRA,代码行数:26,代码来源:FallToEarth.cs
示例10: Tick
public void Tick(Actor self)
{
if (!validTileset)
return;
t += info.RotationStep;
}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:7,代码来源:RotationPaletteEffect.cs
示例11: Tick
public IActivity Tick(Actor self)
{
var targetAltitude = self.Info.Traits.Get<PlaneInfo>().CruiseAltitude;
if (isCanceled || !self.World.Map.IsInMap(self.Location)) return NextActivity;
FlyUtil.Fly(self, targetAltitude);
return this;
}
开发者ID:comradpara,项目名称:OpenRA,代码行数:7,代码来源:FlyTimed.cs
示例12: Tick
public override Activity Tick(Actor self)
{
switch (state)
{
case State.Wait:
return this;
case State.Turn:
state = State.DragIn;
return Util.SequenceActivities(new Turn(112), this);
case State.DragIn:
state = State.Dock;
return Util.SequenceActivities(new Drag(startDock, endDock, 12), this);
case State.Dock:
ru.PlayCustomAnimation(self, "dock", () => { ru.PlayCustomAnimRepeating(self, "dock-loop"); state = State.Loop; });
state = State.Wait;
return this;
case State.Loop:
if (!proc.IsInWorld || proc.IsDead() || harv.TickUnload(self, proc))
state = State.Undock;
return this;
case State.Undock:
ru.PlayCustomAnimBackwards(self, "dock", () => state = State.DragOut);
state = State.Wait;
return this;
case State.DragOut:
return Util.SequenceActivities(new Drag(endDock, startDock, 12), NextActivity);
}
throw new InvalidOperationException("Invalid harvester dock state");
}
开发者ID:Generalcamo,项目名称:OpenRA,代码行数:30,代码来源:HarvesterDockSequence.cs
示例13: ChooseHelipad
static Actor ChooseHelipad(Actor self)
{
var rearmBuildings = self.Info.Traits.Get<HelicopterInfo>().RearmBuildings;
return self.World.Actors.Where( a => a.Owner == self.Owner ).FirstOrDefault(
a => rearmBuildings.Contains(a.Info.Name) &&
!Reservable.IsReserved(a));
}
开发者ID:Iran,项目名称:ClassicRA,代码行数:7,代码来源:HeliReturn.cs
示例14: SetUp
public void SetUp()
{
Location location = new Location (null, new Point (5, 5));
actor = new MockActor (location);
item = new MockItem (location);
}
开发者ID:manicolosi,项目名称:questar,代码行数:7,代码来源:PickUpActionFixture.cs
示例15: Minelayer
public Minelayer(Actor self)
{
this.self = self;
var tileset = self.World.Map.Tileset.ToLowerInvariant();
tile = self.World.Map.Rules.Sequences.GetSequence("overlay", "build-valid-{0}".F(tileset)).GetSprite(0);
}
开发者ID:CH4Code,项目名称:OpenRA,代码行数:7,代码来源:Minelayer.cs
示例16: OnInside
protected override void OnInside(Actor self)
{
self.World.AddFrameEndTask(w =>
{
if (target.IsDead)
return;
if (cloak != null && cloak.Info.UncloakOnDemolish)
cloak.Uncloak();
for (var f = 0; f < flashes; f++)
w.Add(new DelayedAction(flashesDelay + f * flashInterval, () =>
w.Add(new FlashTarget(target, ticks: flashDuration))));
w.Add(new DelayedAction(delay, () =>
{
if (target.IsDead)
return;
var modifiers = target.TraitsImplementing<IDamageModifier>()
.Concat(self.Owner.PlayerActor.TraitsImplementing<IDamageModifier>())
.Select(t => t.GetDamageModifier(self, null));
if (Util.ApplyPercentageModifiers(100, modifiers) > 0)
demolishables.Do(d => d.Demolish(target, self));
}));
});
}
开发者ID:ushardul,项目名称:OpenRA,代码行数:28,代码来源:Demolish.cs
示例17: Tick
public override Activity Tick(Actor self)
{
switch (dockingState)
{
case State.Wait:
return this;
case State.Turn:
dockingState = State.Dock;
if (IsDragRequired)
return ActivityUtils.SequenceActivities(new Turn(self, DockAngle), new Drag(self, StartDrag, EndDrag, DragLength), this);
return ActivityUtils.SequenceActivities(new Turn(self, DockAngle), this);
case State.Dock:
if (Refinery.IsInWorld && !Refinery.IsDead)
foreach (var nd in Refinery.TraitsImplementing<INotifyDocking>())
nd.Docked(Refinery, self);
return OnStateDock(self);
case State.Loop:
if (!Refinery.IsInWorld || Refinery.IsDead || Harv.TickUnload(self, Refinery))
dockingState = State.Undock;
return this;
case State.Undock:
return OnStateUndock(self);
case State.Complete:
if (Refinery.IsInWorld && !Refinery.IsDead)
foreach (var nd in Refinery.TraitsImplementing<INotifyDocking>())
nd.Undocked(Refinery, self);
Harv.LastLinkedProc = Harv.LinkedProc;
Harv.LinkProc(self, null);
if (IsDragRequired)
return ActivityUtils.SequenceActivities(new Drag(self, EndDrag, StartDrag, DragLength), NextActivity);
return NextActivity;
}
throw new InvalidOperationException("Invalid harvester dock state");
}
开发者ID:CH4Code,项目名称:OpenRA,代码行数:35,代码来源:HarvesterDockSequence.cs
示例18: Transforms
public Transforms(ActorInitializer init, TransformsInfo info)
{
self = init.self;
this.info = info;
bi = self.World.Map.Rules.Actors[info.IntoActor].Traits.GetOrDefault<BuildingInfo>();
race = init.Contains<RaceInit>() ? init.Get<RaceInit, string>() : self.Owner.Country.Race;
}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:7,代码来源:Transforms.cs
示例19: UpgradeActorsNear
public UpgradeActorsNear(Actor self, UpgradeActorsNearInfo info)
{
this.info = info;
this.self = self;
cachedRange = info.Range;
cachedVRange = info.MaximumVerticalOffset;
}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:7,代码来源:UpgradeActorsNear.cs
示例20: IssueOrder
public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued)
{
if (order.OrderID == "DeployTransform")
return new Order(order.OrderID, self, queued);
return null;
}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:7,代码来源:Transforms.cs
注:本文中的Actor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论