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


C# Actor.GetMaxHP方法代碼示例

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


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

示例1: Tick

        public void Tick(Actor self)
        {
            var info = self.Info.Traits.Get<SelfHealingInfo>();

            if ((float)self.Health / self.GetMaxHP() >= info.HealIfBelow)
                return;

            if (--ticks <= 0)
            {
                ticks = info.Ticks;
                self.InflictDamage(self, -info.Step, null);
            }
        }
開發者ID:comradpara,項目名稱:OpenRA,代碼行數:13,代碼來源:SelfHealing.cs

示例2: Tick

        public IActivity Tick( Actor self )
        {
            if (isCanceled) return NextActivity;

            self.World.AddFrameEndTask( _ =>
            {
                var oldHP = self.GetMaxHP();
                var newHP = Rules.Info[actor].Traits.Get<OwnedActorInfo>().HP;
                var newHealth = (transferPercentage) ? (int)((float)self.Health/oldHP*newHP) : Math.Min(self.Health, newHP);

                self.Health = 0;
                self.World.Remove( self );
                foreach (var s in sounds)
                    Sound.PlayToPlayer(self.Owner, s);

                var a = self.World.CreateActor( actor, self.Location + offset, self.Owner );
                a.Health = newHealth;
            } );
            return this;
        }
開發者ID:comradpara,項目名稱:OpenRA,代碼行數:20,代碼來源:TransformIntoActor.cs

示例3: GetExtendedState

        ExtendedDamageState GetExtendedState( Actor self, int damage )
        {
            var effectiveHealth = self.Health + damage;

            if (effectiveHealth <= 0)
                return ExtendedDamageState.Dead;

            if (effectiveHealth < self.GetMaxHP() * self.World.Defaults.ConditionRed)
                return ExtendedDamageState.Quarter;

            if (effectiveHealth < self.GetMaxHP() * self.World.Defaults.ConditionYellow)
                return ExtendedDamageState.Half;

            if (effectiveHealth < self.GetMaxHP() * 0.75)
                return ExtendedDamageState.ThreeQuarter;

            return ExtendedDamageState.Normal;
        }
開發者ID:comradpara,項目名稱:OpenRA,代碼行數:18,代碼來源:RenderBuildingWall.cs

示例4: IssueOrder

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

            var isHeal = self.GetPrimaryWeapon().Warheads.First().Damage < 0;
            var forceFire = mi.Modifiers.HasModifier(Modifiers.Ctrl);

            if (isHeal)
            {
                if (underCursor.Owner == null)
                    return null;
                if (self.Owner.Stances[ underCursor.Owner ] != Stance.Ally && !forceFire)
                    return null;
                if (underCursor.Health >= underCursor.GetMaxHP())
                    return null;	// don't allow healing of fully-healed stuff!
            }
            else
                if ((self.Owner.Stances[ underCursor.Owner ] != Stance.Enemy) && !forceFire)
                    return null;

            if (!Combat.HasAnyValidWeapons(self, underCursor)) return null;

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


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