[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/dizzy2003/MLAPI/master/MLAPI-Examples/ManagerExamples.cs [Back]  [Original]

using MLAPI;
using MLAPI.Connection;
using MLAPI.Security;
using MLAPI.Spawning;

namespace MLAPI_Examples
{
    // Features example calls for things often needed for things like Game managers
    public class ManagerExamples : NetworkedBehaviour
    {
        public NetworkedObject GetPlayerGameObject(ulong clientId)
        {
            return SpawnManager.GetPlayerObject(clientId);
        }
        
        // Only runs on host and client
        public NetworkedObject GetLocalPlayerObject()
        {
            return SpawnManager.GetLocalPlayerObject();
        }
        
#if !DISABLE_CRYPTOGRAPHY
        // Only runs on server
        public byte[] GetAESKeyForClient(ulong clientId)
        {
            return CryptographyHelper.GetClientKey(clientId);
        }

        // Only runs on client
        public byte[] GetAESKeyForServer()
        {
            return CryptographyHelper.GetServerKey();
        }
#endif

        // Contains player object, owned objects, cryptography keys and more
        public NetworkedClient GetClient(ulong clientId)
        {
            return NetworkingManager.Singleton.ConnectedClients[clientId];
        }
    }
}

Web Proxy Viewer  |  New URL  |  Original Page