Exemple #1
0
    /// <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);
    }
Exemple #2
0
    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");
    }
Exemple #3
0
	/// <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;
		}
	}
Exemple #4
0
 public TNet.Player GetMyDetails()
 {
     return(TNManager.GetPlayer(TNManager.playerID));
 }
Exemple #5
0
 public TNet.Player GetPlayerDetails(int playerID)
 {
     return(TNManager.GetPlayer(playerID));
 }
Exemple #6
0
 public string GetPlayerName(int playerID)
 {
     return(TNManager.GetPlayer(playerID).name);
 }
Exemple #7
0
 public object GetPlayerData(int playerID)
 {
     return(TNManager.GetPlayer(playerID).data);
 }