本文整理汇总了C#中BasePlayer.IsAlive方法的典型用法代码示例。如果您正苦于以下问题:C# BasePlayer.IsAlive方法的具体用法?C# BasePlayer.IsAlive怎么用?C# BasePlayer.IsAlive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasePlayer
的用法示例。
在下文中一共展示了BasePlayer.IsAlive方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: joinevent
private void joinevent(BasePlayer player, string command, string[] args)
{
if (EventOpen && player.IsAlive() )
{
if((bool)checkCeiling.Call("isCeiling", new object[] { player })){
SendReply(player, "You need to be on the ground floor before teleporting to the event! (This avoids potential death on respawn)");
return;
}
// MeshBatchPhysics.Raycast(player.transform.position + new Vector3(0f, -1.15f, 0f), Vector3Down, out cachedRaycast, out cachedBoolean, out cachedhitInstance);
if (maxSpawns != 0 && EventPlayers.Count >= maxSpawns){
SendReply(player, "Event is full.");
return;
}
if (player.GetComponent<EventPlayer>())
{
if (EventPlayers.Contains(player.GetComponent<EventPlayer>())){
SendReply(player, "You are already in the event.");
return;
}
}
EventPlayer event_player = player.GetComponent<EventPlayer>();
if (event_player == null) event_player = player.gameObject.AddComponent<EventPlayer>();
event_player.inEvent = true;
event_player.enabled = true;
EventPlayers.Add(event_player);
if (player.IsWounded()){ // wounded prior to teleport
player.SetPlayerFlag(BasePlayer.PlayerFlags.Wounded, false);
player.CancelInvoke("WoundingEnd");
player.metabolism.bleeding.value = 0f;
}
player.CancelInvoke("InventoryUpdate"); // bug fix: players who were crafting joined with said crafting items/materials
player.inventory.crafting.CancelAll(true);
SaveHomeLocation(player);
SaveInventory(player);
player.inventory.Strip();
player.SetPlayerFlag(BasePlayer.PlayerFlags.VoiceMuted, true);
//Interface.CallHook("OnEventPlayerSpawn", new object[] { player });
event_player.spawnVec = spawns.First();
ForcePlayerPosition(player, event_player.spawnVec);
if (player.IsWounded()){ // wounded from teleport bug
player.SetPlayerFlag(BasePlayer.PlayerFlags.Wounded, false);
player.CancelInvoke("WoundingEnd");
player.metabolism.bleeding.value = 0f;
}
player.health = 100f;
if(!EventLimitPlayers)
spawns.Remove(event_player.spawnVec);
//updateGUI();
updateGUI(player);
BroadcastToChat(string.Format("{0} has joined the Event! (#<color=red>{1}</color>)", player.displayName, EventPlayers.Count.ToString()));
return;
}
else{
SendReply(player, "Event not open.");
return;
}
}
示例2: EjectPlayer
void EjectPlayer(BasePlayer player)
{
if (player.IsAlive())
{
player.SetPlayerFlag(BasePlayer.PlayerFlags.Wounded, false);
player.CancelInvoke("WoundingEnd");
player.health = 100f;
player.metabolism.bleeding.value = 0f;
}
}