當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。