當前位置: 首頁>>代碼示例>>C#>>正文


C# BasePlayer.IsAlive方法代碼示例

本文整理匯總了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;
            }
        }
開發者ID:stuffedmotion,項目名稱:plugins,代碼行數:69,代碼來源:EventDead.cs

示例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;
     }
 }
開發者ID:stuffedmotion,項目名稱:plugins,代碼行數:10,代碼來源:EventDead.cs


注:本文中的BasePlayer.IsAlive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。