本文整理汇总了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);
}
}
示例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;
}
示例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;
}
示例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);
}