当前位置: 首页>>代码示例>>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;未经允许,请勿转载。