本文整理汇总了C#中OpenRA.Traits.AttackInfo类的典型用法代码示例。如果您正苦于以下问题:C# AttackInfo类的具体用法?C# AttackInfo怎么用?C# AttackInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AttackInfo类属于OpenRA.Traits命名空间,在下文中一共展示了AttackInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DamageStateChanged
public override void DamageStateChanged(Actor self, AttackInfo e)
{
if (lights.CurrentSequence != null)
lights.ReplaceAnim(NormalizeSequence(self, "lights"));
base.DamageStateChanged(self, e);
}
示例2: Damaged
public void Damaged(Actor self, AttackInfo e)
{
if (e.Attacker == null)
return;
if (e.Attacker.Owner == self.Owner)
return;
if (e.Attacker == self.World.WorldActor)
return;
// Only track last hit against our base
if (!self.Info.HasTraitInfo<BuildingInfo>())
return;
if (e.Attacker.Owner.IsAlliedWith(self.Owner) && e.Damage <= 0)
return;
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
{
var rules = self.World.Map.Rules;
Game.Sound.PlayNotification(rules, self.Owner, "Speech", info.Notification, self.Owner.Faction.InternalName);
if (info.AllyNotification != null)
foreach (Player p in self.World.Players)
if (p != self.Owner && p.IsAlliedWith(self.Owner) && p != e.Attacker.Owner)
Game.Sound.PlayNotification(rules, p, "Speech", info.AllyNotification, p.Faction.InternalName);
if (radarPings != null)
radarPings.Add(() => self.Owner.IsAlliedWith(self.World.RenderPlayer), self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
}
lastAttackTime = self.World.WorldTick;
}
示例3: Damaged
public void Damaged(Actor self, AttackInfo e)
{
// only track last hit against our base
if (!self.HasTrait<Building>())
return;
if (e.Attacker == null)
return;
if (e.Attacker.Owner == self.Owner)
return;
if (e.Attacker == self.World.WorldActor)
return;
if (e.Attacker.Owner.IsAlliedWith(self.Owner) && e.Damage <= 0)
return;
if (self.World.WorldTick - lastAttackTime > info.NotifyInterval * 25)
{
Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", info.Notification, self.Owner.Country.Race);
if (radarPings != null)
radarPings.Add(() => self.Owner == self.World.LocalPlayer, self.CenterPosition, info.RadarPingColor, info.RadarPingDuration);
}
lastAttackTime = self.World.WorldTick;
}
示例4: Killed
public void Killed(Actor self, AttackInfo e)
{
var bi = self.Info.Traits.Get<BuildingInfo>();
FootprintUtils.UnpathableTiles(self.Info.Name, bi, self.Location).Do(
t => self.World.AddFrameEndTask(
w => w.Add(new Explosion(w, Traits.Util.CenterOfCell(t), "building", false, 0))));
}
示例5: Killed
public void Killed(Actor self, AttackInfo e)
{
self.World.AddFrameEndTask(w =>
{
var td = new TypeDictionary()
{
new LocationInit( self.Location ),
new CenterLocationInit(self.CenterLocation),
new OwnerInit( self.Owner ),
new SkipMakeAnimsInit()
};
// Allows the husk to drag to its final position
var mobile = self.TraitOrDefault<Mobile>();
if (mobile != null)
{
if (!mobile.CanEnterCell(self.Location, self, false)) return;
td.Add(new HuskSpeedInit(mobile.MovementSpeedForCell(self, self.Location)));
}
var facing = self.TraitOrDefault<IFacing>();
if (facing != null)
td.Add(new FacingInit( facing.Facing ));
var turreted = self.TraitOrDefault<Turreted>();
if (turreted != null)
td.Add( new TurretFacingInit(turreted.turretFacing) );
var huskActor = self.TraitsImplementing<IHuskModifier>()
.Select(ihm => ihm.HuskActor(self))
.FirstOrDefault(a => a != null);
w.CreateActor(huskActor ?? Info.HuskActor, td);
});
}
示例6: Damaged
public override void Damaged(Actor self, AttackInfo e)
{
var oldState = GetExtendedState(self, e.Damage);
var newState = GetExtendedState(self, 0);
if (oldState == newState) return;
switch (newState)
{
case ExtendedDamageState.Normal:
seqName = "idle";
break;
case ExtendedDamageState.ThreeQuarter:
if (damageStates >= 4)
seqName = "minor-damaged-idle";
break;
case ExtendedDamageState.Half:
seqName = "damaged-idle";
Sound.Play(self.Info.Traits.Get<BuildingInfo>().DamagedSound);
break;
case ExtendedDamageState.Quarter:
if (damageStates >= 3)
{
seqName = "critical-idle";
Sound.Play(self.Info.Traits.Get<BuildingInfo>().DamagedSound);
}
break;
}
}
示例7: Damaged
public override void Damaged(Actor self, AttackInfo e)
{
if (!e.DamageStateChanged) return;
var bi = self.Info.Traits.Get<BuildingInfo>();
if (e.DamageState == DamageState.Medium && anim.HasSequence("scratched-idle"))
seqName = "scratched-idle";
else if (e.DamageState <= DamageState.Medium)
seqName = "idle";
else if (e.DamageState == DamageState.Critical && anim.HasSequence("critical-idle"))
{
seqName = "critical-idle";
if (e.DamageState > e.PreviousDamageState)
Sound.Play(bi.DamagedSound, self.CenterLocation);
}
else if (e.DamageState <= DamageState.Critical)
{
seqName = "damaged-idle";
if (e.DamageState > e.PreviousDamageState)
Sound.Play(bi.DamagedSound, self.CenterLocation);
}
anim.PlayFetchIndex(seqName, () => adjacentWalls);
}
示例8: Killed
public void Killed(Actor self, AttackInfo e)
{
var player = (Info.NotifyAll) ? self.World.LocalPlayer : self.Owner;
if (Info.Race != null && Info.Race != self.Owner.Country.Race)
return;
Sound.PlayToPlayer(player, Info.Notification);
}
示例9: Damaged
public void Damaged(Actor self, AttackInfo e)
{
if (!Active) return;
if (!self.HasTrait<AttackBase>()) return;
ReturnFire(self, e, false, false, true); // only triggers when standing still
}
示例10: DamageStateChanged
public void DamageStateChanged(Actor self, AttackInfo e)
{
if (e.DamageState == DamageState.Dead)
Sound.Play(Info.DestroyedSound, self.CenterLocation);
else if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy)
Sound.Play(Info.DamagedSound, self.CenterLocation);
}
示例11: DamageStateChanged
public virtual void DamageStateChanged(Actor self, AttackInfo e)
{
if (e.DamageState >= DamageState.Heavy && e.PreviousDamageState < DamageState.Heavy)
anim.ReplaceAnim("damaged-idle");
else if (e.DamageState < DamageState.Heavy)
anim.ReplaceAnim("idle");
}
示例12: Damaged
public void Damaged(Actor self, AttackInfo e)
{
if (e.DamageState == DamageState.Dead)
{
self.World.WorldActor.traits.Get<ScreenShaker>().AddEffect(10, self.CenterLocation, 1);
Sound.Play(Info.DestroyedSound);
}
}
示例13: Damaged
public void Damaged(Actor self, AttackInfo e)
{
if (e.DamageState == DamageState.Dead)
{
Sound.PlayVoice("Die", self);
self.World.AddFrameEndTask(w => w.Add(new Corpse(self, e.Warhead.InfDeath)));
}
}
示例14: Killed
public void Killed(Actor self, AttackInfo e)
{
var warhead = e.Warhead as DamageWarhead;
// If the warhead is null, the actor was killed by some non-standard means
if (info.DeathTypes.Count == 0 || (warhead != null && warhead.DamageTypes.Overlaps(info.DeathTypes)))
self.PlayVoiceLocal(info.Voice, info.VolumeMultiplier);
}
示例15: Damaged
public void Damaged(Actor self, AttackInfo e)
{
if (e.DamageState == DamageState.Dead)
{
Granted = false;
RefreshGps(self);
}
}