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


C# Traits.AttackInfo类代码示例

本文整理汇总了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);
        }
开发者ID:Tsher,项目名称:OpenRA,代码行数:7,代码来源:RenderBuildingRefinery.cs

示例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;
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:34,代码来源:BaseAttackNotifier.cs

示例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;
        }
开发者ID:ushardul,项目名称:OpenRA,代码行数:28,代码来源:BaseAttackNotifier.cs

示例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))));
 }
开发者ID:katzsmile,项目名称:OpenRA,代码行数:7,代码来源:RenderBuilding.cs

示例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);
            });
        }
开发者ID:Iran,项目名称:ClassicRA,代码行数:35,代码来源:LeavesHusk.cs

示例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;
            }
        }
开发者ID:comradpara,项目名称:OpenRA,代码行数:29,代码来源:RenderBuildingWall.cs

示例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);
        }
开发者ID:geckosoft,项目名称:OpenRA,代码行数:25,代码来源:RenderBuildingWall.cs

示例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);
 }
开发者ID:nevelis,项目名称:OpenRA,代码行数:7,代码来源:ActorLostNotification.cs

示例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
        }
开发者ID:patthoyts,项目名称:OpenRA,代码行数:7,代码来源:UnitStanceHoldGround.cs

示例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);
 }
开发者ID:Iran,项目名称:ClassicRA,代码行数:7,代码来源:SoundOnDamageTransition.cs

示例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");
 }
开发者ID:Iran,项目名称:ClassicRA,代码行数:7,代码来源:RenderBuilding.cs

示例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);
     }
 }
开发者ID:comradpara,项目名称:OpenRA,代码行数:8,代码来源:Building.cs

示例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)));
     }
 }
开发者ID:comradpara,项目名称:OpenRA,代码行数:8,代码来源:RenderInfantry.cs

示例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);
        }
开发者ID:CH4Code,项目名称:OpenRA,代码行数:8,代码来源:DeathSounds.cs

示例15: Damaged

 public void Damaged(Actor self, AttackInfo e)
 {
     if (e.DamageState == DamageState.Dead)
     {
         Granted = false;
         RefreshGps(self);
     }
 }
开发者ID:djohe,项目名称:OpenRA,代码行数:8,代码来源:GpsPower.cs


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