当前位置: 首页>>代码示例>>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;未经允许,请勿转载。