本文整理汇总了C#中BasePlayer.IsDead方法的典型用法代码示例。如果您正苦于以下问题:C# BasePlayer.IsDead方法的具体用法?C# BasePlayer.IsDead怎么用?C# BasePlayer.IsDead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasePlayer
的用法示例。
在下文中一共展示了BasePlayer.IsDead方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RedeemInventory
void RedeemInventory(BasePlayer player)
{
EventPlayer eventplayer = player.GetComponent<EventPlayer>();
if (eventplayer == null) return;
if (player.IsDead() || player.health < 1)
return;
if (eventplayer.savedInventory)
{
eventplayer.player.inventory.Strip();
eventplayer.RestoreInventory();
}
}
示例2: TeleportPlayerHome
void TeleportPlayerHome(BasePlayer player)
{
EventPlayer eventplayer = player.GetComponent<EventPlayer>();
if (eventplayer == null) return;
if (player.IsDead() || player.health < 1)
return;
if (eventplayer.savedHome)
{
eventplayer.TeleportHome();
}
}
示例3: On_PlayerDied
/// <summary>
/// Called from <c>BasePlayer.Die(HitInfo)</c> .
/// </summary>
public static void On_PlayerDied(BasePlayer basePlayer, HitInfo info)
{
using (TimeWarning.New("Player.Die", 0.1f)) {
if (!basePlayer.IsDead()) {
if (info == null) {
info = new HitInfo();
info.damageTypes.Add(basePlayer.lastDamage, Single.MaxValue);
info.Initiator = (BaseEntity)basePlayer;
}
Player victim = Server.GetPlayer(basePlayer);
if (!((bool)basePlayer.CallMethod("WoundInsteadOfDying", info))) {
var pde = new PlayerDeathEvent(victim, info);
OnNext("On_PlayerDied", pde);
if (pde.Die) {
if (info.Initiator != null) {
// PlayerStats statsV = victim.Stats;
if (info.Initiator is BasePlayer) {
Server.GetPlayer(info.Initiator as BasePlayer).Stats.AddKill(true, false);
victim.Stats.AddDeath(true, false);
} else if (info.Initiator is BaseNPC) {
victim.Stats.AddDeath(false, true);
}
}
if (!pde.dropLoot) {
if (basePlayer.belt != null) {
Vector3 vector = new Vector3(UnityEngine.Random.Range(-2f, 2f),
0.2f,
UnityEngine.Random.Range(-2f, 2f));
basePlayer.belt.DropActive(vector.normalized * 3f);
}
basePlayer.inventory.Strip();
}
basePlayer.CallMethodOnBase(typeof(BaseCombatEntity), "Die", info);
}
}
}
}
}