/// <summary> /// This is our chat callback. As messages arrive, they simply get added to the list. /// </summary> [RFC] void OnChat(int playerID, string text) { // Figure out who sent the message and add their name to the text Player player = TNManager.GetPlayer(playerID); Color color = (player.id == TNManager.playerID) ? Color.green : Color.white; AddToChat("[" + player.name + "]: " + text, color); }
void ClaimObject(int playerID, Vector3 pos) { mOwner = TNManager.GetPlayer(playerID); mTrans.position = pos; mTarget = pos; // Move the object to the Ignore Raycast layer while it's being dragged gameObject.layer = LayerMask.NameToLayer((mOwner != null) ? "Ignore Raycast" : "Default"); }
/// <summary> /// Remember the object's ownership, for convenience. /// </summary> void Awake () { // Used for offline mode if (id == 0 && !TNManager.isConnected) id = ++mDummyID; mOwner = TNManager.objectOwnerID; if (TNManager.players.size == 0) { mOwner = TNManager.playerID; } else if (TNManager.GetPlayer(mOwner) == null) { #if UNITY_EDITOR // This shouldn't happen anymore with the latest server/client version Debug.LogWarning("Object is missing its owner, " + mOwner, this); #endif mOwner = TNManager.hostID; } }
public TNet.Player GetMyDetails() { return(TNManager.GetPlayer(TNManager.playerID)); }
public TNet.Player GetPlayerDetails(int playerID) { return(TNManager.GetPlayer(playerID)); }
public string GetPlayerName(int playerID) { return(TNManager.GetPlayer(playerID).name); }
public object GetPlayerData(int playerID) { return(TNManager.GetPlayer(playerID).data); }