本文整理匯總了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);
}