本文整理汇总了C#中BasePlayer类的典型用法代码示例。如果您正苦于以下问题:C# BasePlayer类的具体用法?C# BasePlayer怎么用?C# BasePlayer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BasePlayer类属于命名空间,在下文中一共展示了BasePlayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RustLivePlayer
internal RustLivePlayer(BasePlayer player)
{
this.player = player;
steamId = player.userID;
Character = this;
Object = player;
}
示例2: Awake
void Awake()
{
cameraMove = false;
secondTarget = false;
if (!player)
{
Debug.LogError("Missing player!");
}
else
{
basePlayer = player.GetComponent<BasePlayer>();
if(!basePlayer)
{
Debug.LogError("Missing base player script!");
}
}
if (!goblin)
{
Debug.LogError("Missing goblin!");
}
if (!goblin1)
{
Debug.LogError("Missing goblin1!");
}
if (!mainCamera)
{
Debug.LogError("Missing camera!");
}
}
示例3: HammerEvent
public HammerEvent(HitInfo info, BasePlayer player)
{
_info = info;
basePlayer = player;
string bonename = StringPool.Get(info.HitBone);
HitBone = bonename == "" ? "unknown" : bonename;
}
示例4: ActivateFly
void ActivateFly(BasePlayer player, float speed)
{
fly.Add(player, speed);
oldPos.Add(player, player.transform.position);
player.ChangePlayerState(PlayerState.Type.Spectating, false);
SendReply(player, "FlyMode: Activated, press any key to start flying");
}
示例5: Update
public static void Update(bool withEnts = true)
{
if (entityAddress == 0)
entityAddress = SignatureManager.GetEntityList();
currentList = new EntityList();
var players = new List<BasePlayer>();
var entities = new List<BaseEntity>();
var entityList = Memory.ReadMemory(entityAddress, 4096 * 0x10); //lol
for (int i = 0; i < 64/*BaseClient.GlobalVars.maxClients*/; i++)
{
var entity = BitConverter.ToInt32(entityList, i * 0x10);
if (entity == 0) continue;
var player = new BasePlayer(entity);
players.Add(player);
}
currentList.Players = players;
if (withEnts)
{
for (int i = 64/*BaseClient.GlobalVars.maxClients*/; i < 4096; i++)
{
var entity = BitConverter.ToInt32(entityList, i * 0x10);
if (entity == 0) continue;
var ent = new BaseEntity(entity);
entities.Add(ent);
}
currentList.Entities = entities;
}
}
示例6: 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>());
}
示例7: cmdSpawnOpen
void cmdSpawnOpen(BasePlayer player, string command, string[] args)
{
if (!hasAccess(player)) return;
if (SpawnsData.ContainsKey(player))
{
SendReply(player, "You must save/close your current spawns first. /spawns_help for more informations");
return;
}
if (args == null || args.Length == 0)
{
SendReply(player, "/spawns_remove SPAWN_NUMBER");
return;
}
var NewSpawnFile = Interface.GetMod().DataFileSystem.GetDatafile(args[0].ToString());
if (NewSpawnFile["1"] == null)
{
SendReply(player, "This spawnfile is empty or not valid");
return;
}
SpawnsData.Add(player, new List<Vector3>());
foreach (KeyValuePair<string, object> pair in NewSpawnFile)
{
var currentvalue = pair.Value as Dictionary<string, object>;
((List<Vector3>)SpawnsData[player]).Add(new Vector3(Convert.ToInt32(currentvalue["x"]), Convert.ToInt32(currentvalue["y"]), Convert.ToInt32(currentvalue["z"])));
}
SendReply(player, string.Format("Opened spawnfile with {0} spawns", ((List<Vector3>)SpawnsData[player]).Count.ToString()));
}
示例8: GetOpenDialog
/// <summary>
/// Gets the dialog currently being shown to the specified <paramref name="player" />.
/// </summary>
/// <param name="player">The player whose dialog to get.</param>
/// <returns>The dialog currently being shown to the specified <paramref name="player" />.</returns>
public static Dialog GetOpenDialog(BasePlayer player)
{
if (player == null)
throw new ArgumentNullException(nameof(player));
return OpenDialogs.ContainsKey(player.Id) ? OpenDialogs[player.Id] : null;
}
示例9: AddPlayerLobbyTest
public void AddPlayerLobbyTest()
{
var lobby = new Lobby(new LobbyConfig());
var player = new BasePlayer();
lobby.AddPlayers(new BasePlayerGroup(player));
Assert.IsTrue(lobby.PlayerList.Contains(player));
}
示例10: DamageEventArgs
/// <summary>
/// Initializes a new instance of the DamageEventArgs class.
/// </summary>
/// <param name="otherPlayer">The other player.</param>
/// <param name="amount">Amount of damage done.</param>
/// <param name="weapon">Weapon used to damage another.</param>
/// <param name="bodypart">BodyPart shot at.</param>
public DamageEventArgs(BasePlayer otherPlayer, float amount, Weapon weapon, BodyPart bodypart)
{
OtherPlayer = otherPlayer;
Amount = amount;
Weapon = weapon;
BodyPart = bodypart;
}
示例11: SelectPlayerObjectEventArgs
/// <summary>
/// Initializes a new instance of the <see cref="SelectPlayerObjectEventArgs" /> class.
/// </summary>
/// <param name="player">The player.</param>
/// <param name="object">The player object.</param>
/// <param name="modelid">The modelid.</param>
/// <param name="position">The position.</param>
public SelectPlayerObjectEventArgs(BasePlayer player, PlayerObject @object, int modelid, Vector3 position)
: base(position)
{
Player = player;
Object = @object;
ModelId = modelid;
}
示例12: Load_Player
public BasePlayer Load_Player(string user)
{
//Debug.Log(Get_Random_User());
user = user.ToLower().Replace(" ", string.Empty);
//GameManager.instance.player = new BasePlayer();
//GameManager.instance.player.Player_Spell_Book = new SpellBook();
//GameManager.instance.player.Player_Spell_Inventory = new SpellInventory();
//GameManager.instance.player.Player_Name = user;
BasePlayer player = new BasePlayer();
player.Player_Spell_Book = new SpellBook();
player.Player_Spell_Inventory = new SpellInventory();
player.Player_Name = user;
player.Players_Summon = Load_Player_Summon(user);
Load_Player_Spell_Inventory(user, ref player);
spell_book_db.Load("Assets/Scripts/Grimoire/Database/SpellBookDatabase.xml");
spell_book_root = spell_book_db.DocumentElement;
string path = "descendant::Book[@id='" + user + "']";
XmlNode book = spell_book_root.SelectSingleNode(path);
if (book == null)
{
return null;
}
//Debug.Log("Spell Book Elements: " + book.ChildNodes.Count);
foreach (XmlNode spell in book.ChildNodes)
{
Add_Spell(spell.InnerText, "spell_book", ref player);
}
return player;
}
示例13: ApplyEffect
public void ApplyEffect(BasePlayer p)
{
switch (Type)
{
// More power
case PowerUpType.Power:
p.IncreasePower(1);
break;
// More bombs
case PowerUpType.Bomb:
p.IncreaseTotalBombNumber(1);
break;
// More speed
case PowerUpType.Speed:
p.IncreaseSpeed(GameConfiguration.BasePlayerSpeed * (GameConfiguration.PlayerSpeedIncrementeurPercentage/100));
break;
// Skeleton ! => Bad items
case PowerUpType.BadEffect:
int randomBadEffect = GameConfiguration.Random.Next(GameConfiguration.BadEffectList.Count);
p.ApplyBadItem(GameConfiguration.BadEffectList[randomBadEffect]);
break;
// More points
case PowerUpType.Score:
p.Stats.Score++;
break;
}
}
示例14: StackAllCommand
private void StackAllCommand(BasePlayer player, string command, string[] args)
{
if (!hasPermission(player, "canChangeStackSize"))
{
SendReply(player, "You don't have permission to use this command.");
return;
}
if (args.Length == 0)
{
SendReply(player, "Syntax Error: Requires 1 argument. Syntax Example: /stackall 65000");
return;
}
var itemList = ItemManager.itemList;
foreach (var item in itemList)
{
if (item.displayName.english.ToString() == "Salt Water" ||
item.displayName.english.ToString() == "Water") { continue; }
Config[item.displayName.english] = Convert.ToInt32(args[0]);
item.stackable = Convert.ToInt32(args[0]);
}
SaveConfig();
SendReply(player, "The Stack Size of all stackable items has been set to " + args[0]);
}
示例15: spawnWall
private void spawnWall(BasePlayer player, string cmd, string[] args)
{
var pos = player.transform.position;
pos.z += 2;
var angles = new Quaternion();
var prefab = GameManager.server.CreatePrefab("assets/prefabs/building/wall.external.high.stone/wall.external.high.stone.prefab", pos, angles, true);
if (prefab == null)
{
this.SendReply(player, "Prefab is null");
return;
}
var block = prefab.GetComponent<BuildingBlock>();
if (block == null)
{
this.SendReply(player, "Building block is null");
return;
}
block.transform.position = pos;
block.transform.rotation = angles;
block.gameObject.SetActive(true);
block.blockDefinition = PrefabAttribute.server.Find<Construction>(block.prefabID);
block.Spawn(true);
block.health = block.MaxHealth();
block.SendNetworkUpdate();
}