Class Manus::Networking::Peer
ClassList > Manus > Networking > Peer
This class is what the Client and Server are based upon. It contains information and functions required for basic functionality.
Inherited by the following classes: Manus::Networking::Client, Manus::Networking::Server
Public Functions
| Type | Name | 
|---|---|
| NetObject | CreateObject (NetObject p_NetObj, UnityEngine.Vector3 p_Position, UnityEngine.Quaternion p_Rotation) This function must be implemented to allow objects to be created. | 
| void | DestroyObject (NetObject p_NetObj) This function must be implemented to allow objects to be destroyed. | 
| long | GetID () Gets the ID of this peer. | 
| NetObject | GetNetObject (long p_NetID) Get the NetObject with a given NetID. | 
| List< NetObject > | GetNetObjects () Returns all the NetObjects. | 
| List< NetObject > | GetNetObjectsControlledByPlayer (long p_PlayerNetID) Returns all the NetObjects that a given player controls. | 
| void | HandleIncomingMessages () This function must be implemented to handle the Incoming Messages. | 
| void | RegisterMessage (Message.Type p_ID, ReceiveMessageFunc p_Msg) Register a message to listen for. Custom message types should start with ID's LARGER than Message.Type.CustomMessage. | 
| void | RegisterMessage (ushort p_ID, ReceiveMessageFunc p_Msg) Register a message to listen for. Custom message types should start with ID's LARGER than Message.Type.CustomMessage. | 
| void | ReleaseControlOfObject (NetObject p_NetObj) This function must be implemented to allow objects to be released by others. | 
| void | SendMessage (Message.Type p_Type, LidNet.NetBuffer p_Msg) Call this function to send messages. | 
| void | SendMessage (ushort p_Type, LidNet.NetBuffer p_Msg) Call this function to send custom messages to the server. | 
| void | SetNetObjectManager (NetObjectManager p_Manager) Sets the NetObjectManager for managing the NetObjects. | 
| void | Shutdown () This function must be implemented to shut the Peer down. | 
| void | Start () This function must be implemented to start the Peer. | 
| void | TakeControlOfObject (NetObject p_NetObj) This function must be implemented to allow objects to be controlled by others. | 
| void | UnregisterMessage (Message.Type p_ID) Stop listening for a certain message. Custom message types should start with ID's LARGER than Message.Type.CustomMessage. | 
| void | UnregisterMessage (ushort p_ID) Stop listening for a certain message. Custom message types should start with ID's LARGER than Message.Type.CustomMessage. | 
| void | Update (float p_DT) Update function, updates whatever is desired on this Peer. | 
Protected Attributes
| Type | Name | 
|---|---|
| long | m_ID   = = 0 The ID assigned to this Peer by itself or the peer who controls ID assignment. | 
| NetworkManager | m_Manager   = = null The NetworkManager that this peer has been created by. | 
| Dictionary< ushort, ReceiveMessageFunc > | m_Messages   = = new Dictionary<ushort, ReceiveMessageFunc>() | 
| NetObjectManager | m_NetObjectManager The NetObjectManager that this peer uses to manage its objects. | 
Public Functions Documentation
function CreateObject
This function must be implemented to allow objects to be created.
NetObject Manus::Networking::Peer::CreateObject (
    NetObject p_NetObj,
    UnityEngine.Vector3 p_Position,
    UnityEngine.Quaternion p_Rotation
) 
Parameters:
- p_NetObjThe prefab of the NetObject to create.
- p_PositionThe initial position of the spawned object.
- p_RotationThe initial rotation of the spawned object.
Returns:
NULL if NetObject not found or not instantly created
function DestroyObject
This function must be implemented to allow objects to be destroyed.
Parameters:
- p_NetObjThe prefab of the NetObject to destroy.
function GetID
Gets the ID of this peer.
Returns:
The ID of this peer.
function GetNetObject
Get the NetObject with a given NetID.
Parameters:
- p_NetIDNetID to get
Returns:
function GetNetObjects
Returns all the NetObjects.
Returns:
A List of NetObjects
function GetNetObjectsControlledByPlayer
Returns all the NetObjects that a given player controls.
inline List< NetObject > Manus::Networking::Peer::GetNetObjectsControlledByPlayer (
    long p_PlayerNetID
) 
Parameters:
- p_PlayerNetIDThe controller's ID
Returns:
A List of NetObjects
function HandleIncomingMessages
function RegisterMessage [1/2]
Register a message to listen for. Custom message types should start with ID's LARGER than Message.Type.CustomMessage.
inline void Manus::Networking::Peer::RegisterMessage (
    Message.Type p_ID,
    ReceiveMessageFunc p_Msg
) 
Parameters:
- p_IDA Message Type
- p_MsgThe Function to call when receiving this message
function RegisterMessage [2/2]
Register a message to listen for. Custom message types should start with ID's LARGER than Message.Type.CustomMessage.
Parameters:
- p_IDA Message Type
- p_MsgThe Function to call when receiving this message
function ReleaseControlOfObject
This function must be implemented to allow objects to be released by others.
Parameters:
- p_NetObjThe prefab of the NetObject to release control of.
function SendMessage [1/2]
Call this function to send messages.
Parameters:
- p_TypeThe Message Type
- p_MsgThe Message
function SendMessage [2/2]
Call this function to send custom messages to the server.
Parameters:
- p_TypeThe Message Type
- p_MsgThe Message
function SetNetObjectManager
Sets the NetObjectManager for managing the NetObjects.
Parameters:
- p_ManagerThe NetObjectManager
function Shutdown
function Start
function TakeControlOfObject
This function must be implemented to allow objects to be controlled by others.
Parameters:
- p_NetObjThe prefab of the NetObject to take control of.
function UnregisterMessage [1/2]
Stop listening for a certain message. Custom message types should start with ID's LARGER than Message.Type.CustomMessage.
Parameters:
- p_IDA Message Type
function UnregisterMessage [2/2]
Stop listening for a certain message. Custom message types should start with ID's LARGER than Message.Type.CustomMessage.
Parameters:
- p_IDA Message Type
function Update
Update function, updates whatever is desired on this Peer.
Parameters:
- p_DT(Delta Time) Time passed since last Update Call
Protected Attributes Documentation
variable m_ID
variable m_Manager
variable m_Messages
variable m_NetObjectManager
The documentation for this class was generated from the following file api/unity-plugin/Scripts/Networking/Peer.cs