当前位置: 首页>>代码示例>>C#>>正文


C# BasePlayer.GetComponent方法代码示例

本文整理汇总了C#中BasePlayer.GetComponent方法的典型用法代码示例。如果您正苦于以下问题:C# BasePlayer.GetComponent方法的具体用法?C# BasePlayer.GetComponent怎么用?C# BasePlayer.GetComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BasePlayer的用法示例。


在下文中一共展示了BasePlayer.GetComponent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: cmdWaypointsClose

 void cmdWaypointsClose(BasePlayer player, string command, string[] args)
 {
     if (!hasAccess(player)) return;
     if (!isEditingWP(player, 1)) return;
     SendReply(player, "Waypoints: Closed without saving");
     GameObject.Destroy(player.GetComponent<WaypointEditor>());
 }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:7,代码来源:Waypoints.cs

示例2: cmdWaypointsAdd

        void cmdWaypointsAdd(BasePlayer player, string command, string[] args)
        {
            if (!hasAccess(player)) return;
            if (!isEditingWP(player, 1)) return;
            var WaypointEditor = player.GetComponent<WaypointEditor>();
            if (WaypointEditor.targetWaypoint == null)
            {
                SendReply(player, "Waypoints: Something went wrong while getting your WaypointList");
                return;
            }
            float speed = 3f;
            if (args.Length > 0) float.TryParse(args[0], out speed);
            WaypointEditor.targetWaypoint.AddWaypoint(player.transform.position, speed);

            SendReply(player, string.Format("Waypoint Added: {0} {1} {2} - Speed: {3}", player.transform.position.x.ToString(), player.transform.position.y.ToString(), player.transform.position.z.ToString(), speed.ToString()));
        }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:16,代码来源:Waypoints.cs

示例3: hasNoArguments

 /////////////////////////////////////////////////////
 ///  hasNoArguments(BasePlayer player, string[] args)
 ///  Action when no arguments were written in the commands
 /////////////////////////////////////////////////////
 bool hasNoArguments(BasePlayer player, string[] args)
 {
     if (args == null || args.Length == 0)
     {
         var buildPlayer = player.GetComponent<BuildPlayer>();
         if (buildPlayer != null)
         {
             buildPlayer.DestroyGui();
             UnityEngine.Object.Destroy(buildPlayer);
             SendReply(player, "Build Tool Deactivated");
         }
         else
             SendReply(player, "For more informations say: /buildhelp");
         return true;
     }
     return false;
 }
开发者ID:mpendel,项目名称:RUSTBOYS,代码行数:21,代码来源:Build.cs

示例4: 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();
     }
 }
开发者ID:stuffedmotion,项目名称:plugins,代码行数:11,代码来源:EventDead.cs

示例5: SaveHomeLocation

 void SaveHomeLocation(BasePlayer player)
 {
     EventPlayer eventplayer = player.GetComponent<EventPlayer>();
     if (eventplayer == null) return;
     eventplayer.SaveHome();
 }
开发者ID:stuffedmotion,项目名称:plugins,代码行数:6,代码来源:EventDead.cs

示例6: OnPlayerRespawned

 void OnPlayerRespawned(BasePlayer player)
 {
     if (!(player.GetComponent<EventPlayer>())) return;
     if (player.GetComponent<EventPlayer>().savedInventory || player.GetComponent<EventPlayer>().savedHome)
     {
         player.GetComponent<EventPlayer>().inEvent = false;
         updateGUI(player);
         RedeemInventory(player);
         TeleportPlayerHome(player);
         EventPlayers.Remove(player.GetComponent<EventPlayer>());
         TryErasePlayer(player);
         player.health = 100f;
     }
 }
开发者ID:stuffedmotion,项目名称:plugins,代码行数:14,代码来源:EventDead.cs

示例7: LeaveEvent

 object LeaveEvent(BasePlayer player)
 {
     if (player.GetComponent<EventPlayer>() == null)
     {
         return "You are not currently in the Event.";
     }
     if (!EventPlayers.Contains(player.GetComponent<EventPlayer>()))
     {
         return "You are not currently in the Event.";
     }
     player.GetComponent<EventPlayer>().inEvent = false;
     //BroadcastToChat(string.Format(MessagesEventLeft, player.displayName.ToString(), (EventPlayers.Count - 1).ToString()));
     updateGUI(player);
     addBackSpawn(player);
     player.inventory.Strip();
     RedeemInventory(player);
     TeleportPlayerHome(player);
     EventPlayers.Remove(player.GetComponent<EventPlayer>());
     EjectPlayer(player);
     TryErasePlayer(player);
     CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = player.net.connection }, null, "DestroyUI", new Facepunch.ObjectList("event_blackout", null, null, null, null));
     return true;
 }
开发者ID:stuffedmotion,项目名称:plugins,代码行数:23,代码来源:EventDead.cs

示例8: addBackSpawn

 void addBackSpawn(BasePlayer player)
 {
     if(!EventLimitPlayers)
         spawns.Add(player.GetComponent<EventPlayer>().spawnVec);
 }
开发者ID:stuffedmotion,项目名称:plugins,代码行数:5,代码来源:EventDead.cs

示例9: OnPlayerAttack

        void OnPlayerAttack(BasePlayer attacker, HitInfo hit)
        {
            if (attacker.GetComponent<EventPlayerTeleporting>() != null)
            {
                hit.damageTypes = new Rust.DamageTypeList();
                hit.HitMaterial = 0;
                hit.PointStart = Vector3.zero;
                attacker.metabolism.bleeding.Reset();

                return;
            }

            if (!EventLobby && eventPlayers.Count > 0)
            {
                if (hit.HitEntity is BasePlayer)
                {
                    OnAttackShared(attacker, hit.HitEntity as BasePlayer, ref hit);
                }
            }
        }
开发者ID:danniehansen,项目名称:EdgePlugins,代码行数:20,代码来源:SkyEvent.cs

示例10: OnAttackShared

        private object OnAttackShared(BasePlayer attacker, BasePlayer victim, ref HitInfo hit)
        {
            if (victim.GetComponent<EventPlayerTeleporting>() != null)
            {
                hit.damageTypes = new Rust.DamageTypeList();
                hit.HitMaterial = 0;
                hit.PointStart = Vector3.zero;
                victim.metabolism.bleeding.Reset();

                return false;
            }

            if (!EventLobby && eventPlayers.Count > 0 && victim.GetComponent<EventPlayer>() == null)
            {
                hit.damageTypes = new Rust.DamageTypeList();
                hit.HitMaterial = 0;
                hit.PointStart = Vector3.zero;
                victim.metabolism.bleeding.Reset();

                return false;
            }

            return true;
        }
开发者ID:danniehansen,项目名称:EdgePlugins,代码行数:24,代码来源:SkyEvent.cs

示例11: PlayerInit

 void PlayerInit(BasePlayer player)
 {
     if (jaildata[player.userID.ToString()] != null)
     {
         if (!inJail(player.GetComponent<BaseEntity>()))
             SendPlayerToJail(player);
     }
 }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:8,代码来源:Jail.cs

示例12: cmdChatJailConfig

 void cmdChatJailConfig(BasePlayer player, string command, string[] args)
 {
     if (player.GetComponent<BaseNetworkable>().net.connection.authLevel < 1)
     {
         SendReply(player, "You are not allowed to use this command.");
         return;
     }
     if (args.Length < 2)
     {
         SendReply(player, "/jail_config jail_spawnfile jailspawnfile => set the spawns where players will be jailed");
         SendReply(player, "/jail_config free_spawnfile freespawnfile => set the spawns where players will be freed");
         SendReply(player, "/jail_config zone RADIUS");
         SendReply(player, "You must stand in the center of the radius zone of the jail.");
         return;
     }
     if (args[0] == "zone")
     {
         float radius = Convert.ToSingle(args[1]);
         jailconfig["radius"] = radius.ToString();
         jailconfig["zonex"] = player.transform.position.x.ToString();
         jailconfig["zoney"] = player.transform.position.y.ToString();
         jailconfig["zonez"] = player.transform.position.z.ToString();
         SendReply(player, "New Zone {0} {1} {2} with Radius {3}", jailconfig["zonex"].ToString(), jailconfig["zoney"].ToString(), jailconfig["zonez"].ToString(), jailconfig["radius"].ToString());
         LoadZone();
     }
     else if (args[0] == "free_spawnfile")
     {
         var count = Interface.GetMod().CallHook("GetSpawnsCount", new object[] { args[1] });
         if (count == null)
         {
             SendReply(player, "SpawnFile {0} is not a valid spawnfile", jailconfig["free_spawnfile"].ToString());
             jailconfig["free_spawnfile"] = null;
         }
         else
         {
             jailconfig["free_spawnfile"] = args[1];
             SendReply(player, "New SpawnFile for Freed players: {0}", jailconfig["free_spawnfile"].ToString());
             LoadSpawnfile();
         }
     }
     else if (args[0] == "jail_spawnfile")
     {
         var count = Interface.GetMod().CallHook("GetSpawnsCount", new object[] { args[1] });
         if (count == null)
         {
             SendReply(player, "SpawnFile {0} is not a valid spawnfile", jailconfig["jail_spawnfile"].ToString());
             jailconfig["jail_spawnfile"] = null;
         }
         else
         {
             jailconfig["jail_spawnfile"] = args[1];
             SendReply(player, "New SpawnFile for Jaild Players: {0}", jailconfig["jail_spawnfile"].ToString());
             LoadSpawnfile();
         }
     }
     SaveDataConfig();
 }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:57,代码来源:Jail.cs

示例13: GetBuildPlayer

 /////////////////////////////////////////////////////
 ///  GetBuildPlayer(BasePlayer player)
 ///  Create or Get the BuildPlayer from a player, where all informations of current action is stored
 /////////////////////////////////////////////////////
 BuildPlayer GetBuildPlayer(BasePlayer player)
 {
     if (player.GetComponent<BuildPlayer>() == null)
         return player.gameObject.AddComponent<BuildPlayer>();
     else
         return player.GetComponent<BuildPlayer>();
 }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:11,代码来源:Build.cs

示例14: cmdChatErase

 void cmdChatErase(BasePlayer player, string command, string[] args)
 {
     if (!hasAccess(player)) return;
     BuildPlayer buildplayer = GetBuildPlayer(player);
     if (buildplayer.currentType != null && buildplayer.currentType == "erase")
     {
         UnityEngine.GameObject.Destroy(player.GetComponent<BuildPlayer>());
         SendReply(player, "Building Tool: Remove Deactivated");
     }
     else
     {
         buildplayer.currentType = "erase";
         SendReply(player, "Building Tool: Remove Activated");
     }
 }
开发者ID:vividentity,项目名称:Oxide2Plugins,代码行数:15,代码来源:Build.cs

示例15: EventReward

        void EventReward(BasePlayer player)
        {
            EventWinner winner = player.GetComponent<EventWinner>();

            if (winner != null)
            {
                clearGUI(player);

                player.GiveItem(ItemManager.CreateByPartialName("supply.signal", winner.amount));

                UnityEngine.GameObject.Destroy(winner);

                PrintChat(player, "Your reward has been added to your inventory.");
            }
            else
            {
                PrintChat(player, "You haven't won the event.");
            }
        }
开发者ID:danniehansen,项目名称:EdgePlugins,代码行数:19,代码来源:SkyEvent.cs


注:本文中的BasePlayer.GetComponent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。