當前位置: 首頁>>代碼示例>>C#>>正文


C# Actor.GetDamageState方法代碼示例

本文整理匯總了C#中Actor.GetDamageState方法的典型用法代碼示例。如果您正苦於以下問題:C# Actor.GetDamageState方法的具體用法?C# Actor.GetDamageState怎麽用?C# Actor.GetDamageState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Actor的用法示例。


在下文中一共展示了Actor.GetDamageState方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: IsValidAgainst

        public override bool IsValidAgainst(Actor victim, Actor firedBy)
        {
            if (Damage < 0 && victim.GetDamageState() == DamageState.Undamaged)
                return false;

            return base.IsValidAgainst(victim, firedBy);
        }
開發者ID:CH4Code,項目名稱:OpenRA,代碼行數:7,代碼來源:DamageWarhead.cs

示例2: BuildingComplete

 public void BuildingComplete(Actor self)
 {
     var animation = (self.GetDamageState() >= DamageState.Heavy) ? "damaged-idle" : "idle";
     DefaultAnimation.PlayFetchIndex(animation,
         () => playerResources.OreCapacity != 0
         ? ((10 * DefaultAnimation.CurrentSequence.Length - 1) * playerResources.Ore) / (10 * playerResources.OreCapacity)
             : 0);
 }
開發者ID:RunCraze,項目名稱:OpenRA,代碼行數:8,代碼來源:RenderBuildingSilo.cs

示例3: BuildingComplete

 public void BuildingComplete(Actor self)
 {
     var animation = (self.GetDamageState() >= DamageState.Heavy) ? "damaged-idle" : "idle";
     anim.PlayFetchIndex(animation,
         () => playerResources.OreCapacity != 0
             ? (Info.FillSteps * playerResources.Ore) / (10 * playerResources.OreCapacity)
             : 0);
 }
開發者ID:Tsher,項目名稱:OpenRA,代碼行數:8,代碼來源:RenderBuildingSilo.cs

示例4: BuildingComplete

        public override void BuildingComplete(Actor self)
        {
            var animation = RenderSprites.NormalizeSequence(DefaultAnimation, self.GetDamageState(), info.Sequence);

            DefaultAnimation.PlayFetchIndex(animation,
                () => playerResources.ResourceCapacity != 0
                ? ((10 * DefaultAnimation.CurrentSequence.Length - 1) * playerResources.Resources) / (10 * playerResources.ResourceCapacity)
                    : 0);
        }
開發者ID:ushardul,項目名稱:OpenRA,代碼行數:9,代碼來源:RenderBuildingSilo.cs

示例5: Tick

        public void Tick(Actor self)
        {
            if (--ticks <= 0)
            {
                var move = self.Trait<IMove>();
                if (move.Altitude > 0 && self.GetDamageState() >= DamageState.Heavy)
                {
                    var facing = self.Trait<IFacing>();
                    var altitude = new PVecInt(0, move.Altitude);
                    position = (self.CenterLocation - (PVecInt)Combat.GetTurretPosition(self, facing, smokeTurret).ToInt2());

                    if (self.World.RenderedShroud.IsVisible(position.ToCPos()))
                        self.World.AddFrameEndTask(
                            w => w.Add(new Smoke(w, position - altitude, "smokey")));
                }

                ticks = interval;
            }
        }
開發者ID:nevelis,項目名稱:OpenRA,代碼行數:19,代碼來源:SmokeTrailWhenDamaged.cs

示例6: SelectionBoxRenderable

        IEnumerable<IRenderable> IRenderAboveShroud.RenderAboveShroud(Actor self, WorldRenderer wr)
        {
            if (self.World.FogObscures(self))
                yield break;

            var selected = self.World.Selection.Contains(self);
            var regularWorld = self.World.Type == WorldType.Regular;
            var statusBars = Game.Settings.Game.StatusBars;

            // Health bars are shown when:
            //  * actor is selected
            //  * status bar preference is set to "always show"
            //  * status bar preference is set to "when damaged" and actor is damaged
            var displayHealth = selected || (regularWorld && statusBars == StatusBarsType.AlwaysShow)
                || (regularWorld && statusBars == StatusBarsType.DamageShow && self.GetDamageState() != DamageState.Undamaged);

            // Extra bars are shown when:
            //  * actor is selected
            //  * status bar preference is set to "always show"
            //  * status bar preference is set to "when damaged"
            var displayExtra = selected || (regularWorld && statusBars != StatusBarsType.Standard);

            if (Info.RenderSelectionBox && selected)
                yield return new SelectionBoxRenderable(self, Info.SelectionBoxColor);

            if (Info.RenderSelectionBars && (displayHealth || displayExtra))
                yield return new SelectionBarsRenderable(self, displayHealth, displayExtra);

            // Target lines and pips are always only displayed for selected allied actors
            if (!selected || !self.Owner.IsAlliedWith(wr.World.RenderPlayer))
                yield break;

            if (self.World.LocalPlayer != null && self.World.LocalPlayer.PlayerActor.Trait<DeveloperMode>().PathDebug)
                yield return new TargetLineRenderable(ActivityTargetPath(self), Color.Green);

            var b = self.VisualBounds;
            var pos = wr.ScreenPxPosition(self.CenterPosition);
            var bl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Bottom));
            var pal = wr.Palette(Info.Palette);

            foreach (var r in DrawPips(self, wr, bl, pal))
                yield return r;
        }
開發者ID:OpenRA,項目名稱:OpenRA,代碼行數:43,代碼來源:SelectionDecorations.cs

示例7: NormalizeSequence

 protected virtual string NormalizeSequence(Actor self, string baseSequence)
 {
     string damageState = self.GetDamageState() >= DamageState.Heavy ? "damaged-" : "";
     if (anim.HasSequence(damageState + baseSequence))
         return damageState + baseSequence;
     else
         return baseSequence;
 }
開發者ID:Tsher,項目名稱:OpenRA,代碼行數:8,代碼來源:RenderSimple.cs

示例8: BuildingComplete

 public void BuildingComplete( Actor self )
 {
     roof.Play(NormalizeSequence(self,
         self.GetDamageState() > DamageState.Heavy ? "damaged-idle-top" : "idle-top"));
     buildComplete = true;
 }
開發者ID:RunCraze,項目名稱:OpenRA,代碼行數:6,代碼來源:RenderBuildingWarFactory.cs

示例9: GetPrefix

 protected string GetPrefix(Actor self)
 {
     return self.GetDamageState() == DamageState.Half ? "damaged-" : "";
 }
開發者ID:comradpara,項目名稱:OpenRA,代碼行數:4,代碼來源:RenderBuilding.cs

示例10: ShouldLandAtBuilding

        bool ShouldLandAtBuilding(Actor self, Actor dest)
        {
            if (alwaysLand)
                return true;

            if (planeInfo.RepairBuildings.Contains(dest.Info.Name) && self.GetDamageState() != DamageState.Undamaged)
                return true;

            return planeInfo.RearmBuildings.Contains(dest.Info.Name) && self.TraitsImplementing<AmmoPool>()
                    .Any(p => !p.Info.SelfReloads && !p.FullAmmo());
        }
開發者ID:pchote,項目名稱:OpenRA,代碼行數:11,代碼來源:ReturnToBase.cs

示例11: BuildingComplete

 public void BuildingComplete( Actor self )
 {
     roof.Play(NormalizeSequence(self,
         self.GetDamageState() > DamageState.Heavy ? "damaged-idle-top" : "idle-top"));
     self.Trait<RenderSimple>().anims.Add( "roof", new RenderSimple.AnimationWithOffset( roof ) { ZOffset = 24 } );
 }
開發者ID:patthoyts,項目名稱:OpenRA,代碼行數:6,代碼來源:RenderBuildingWarFactory.cs

示例12: GetPrefix

 protected virtual string GetPrefix(Actor self)
 {
     return self.GetDamageState() >= DamageState.Heavy ? "damaged-" : "";
 }
開發者ID:mgatland,項目名稱:OpenRA,代碼行數:4,代碼來源:RenderSimple.cs

示例13: IssueOrder

        public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor)
        {
            if (mi.Button == MouseButton.Left) return null;
            if (self == underCursor) return null;

            var target = underCursor == null ? Target.FromCell(xy) : Target.FromActor(underCursor);

            var isHeal = Weapons[0].Info.Warheads[0].Damage < 0;
            var forceFire = mi.Modifiers.HasModifier(Modifiers.Ctrl);

            if (isHeal)
            {
                // we can never "heal ground"; that makes no sense.
                if (!target.IsActor) return null;

                // unless forced, only heal allies.
                if (self.Owner.Stances[underCursor.Owner] != Stance.Ally && !forceFire) return null;

                // don't allow healing of fully-healed stuff!
                if (underCursor.GetDamageState() == DamageState.Undamaged) return null;
            }
            else
            {
                if (!target.IsActor)
                {
                    if (!forceFire) return null;
                    return new Order("Attack", self, xy);
                }

                if ((self.Owner.Stances[underCursor.Owner] != Stance.Enemy) && !forceFire)
                    return null;
            }

            if (!HasAnyValidWeapons(target)) return null;

            return new Order(isHeal ? "Heal" : "Attack", self, underCursor);
        }
開發者ID:mgatland,項目名稱:OpenRA,代碼行數:37,代碼來源:AttackBase.cs


注:本文中的Actor.GetDamageState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。