internal NetworkP2PHandoverInstance(NetBuffer buffer)
        {
            _networkView = null;

            position   = new Vector3(buffer.ReadFloat(), buffer.ReadFloat(), buffer.ReadFloat());
            rotation   = new Quaternion(buffer.ReadFloat(), buffer.ReadFloat(), buffer.ReadFloat(), buffer.ReadFloat());
            relativeTo = (NetworkP2PSpace)buffer.ReadByte();

            remoteViewID           = new NetworkViewID(buffer);
            group                  = new NetworkGroup(buffer);
            authFlags              = (NetworkAuthFlags)buffer.ReadByte();
            isInstantiatedRemotely = buffer.ReadBoolean();

            proxyPrefab  = buffer.ReadString();
            ownerPrefab  = buffer.ReadString();
            serverPrefab = buffer.ReadString();

            cellAuthPrefab  = buffer.ReadString();
            cellProxyPrefab = buffer.ReadString();

            uint initialSize = buffer.ReadVariableUInt32();

            _initialData = initialSize != 0 ? buffer.ReadBytes((int)initialSize) : new byte[0];

            uint handoverSize = buffer.ReadVariableUInt32();

            _handoverData = handoverSize != 0 ? buffer.ReadBytes((int)handoverSize) : new byte[0];

            _isInstantiatable = true;
            _networkP2P       = null;
        }
 /// <summary>
 /// Creates a NetworkViewData object with the provided arguments.
 /// </summary>
 /// <param name="viewID"></param>
 /// <param name="owner"></param>
 /// <param name="group"></param>
 /// <param name="authFlags"></param>
 /// <param name="isInstantiatedRemotely"></param>
 /// <param name="proxyPrefab"></param>
 /// <param name="ownerPrefab"></param>
 /// <param name="serverPrefab"></param>
 /// <param name="cellAuthPrefab"></param>
 /// <param name="cellProxyPrefab"></param>
 /// <param name="initialData"></param>
 public NetworkViewData(NetworkViewID viewID, NetworkPlayer owner, NetworkGroup group, NetworkAuthFlags authFlags, bool isInstantiatedRemotely, string proxyPrefab, string ownerPrefab, string serverPrefab, string cellAuthPrefab, string cellProxyPrefab, BitStream initialData)
 {
     this.viewID    = viewID;
     this.owner     = owner;
     this.group     = group;
     this.authFlags = authFlags;
     this.isInstantiatedRemotely = isInstantiatedRemotely;
     this.proxyPrefab            = proxyPrefab;
     this.ownerPrefab            = ownerPrefab;
     this.serverPrefab           = serverPrefab;
     this.cellAuthPrefab         = cellAuthPrefab;
     this.cellProxyPrefab        = cellProxyPrefab;
     this.initialData            = initialData;
 }
        /// <summary>
        /// Creates and initializes a new instance of NetworkP2PHandoverInstance.
        /// </summary>
        /// <param name="networkView">The network view to use for the object being handovered.</param>
        /// <param name="position">Position of the object being handovered.</param>
        /// <param name="rotation">Rotation to use for the object being handovered.</param>
        /// <param name="relativeTo">The space that position and rotation should be relative to.</param>
        public NetworkP2PHandoverInstance(NetworkViewBase networkView, Vector3 position, Quaternion rotation, NetworkP2PSpace relativeTo)
        {
            this.position   = position;
            this.rotation   = rotation;
            this.relativeTo = relativeTo;

            _networkView           = networkView.root as NV;   // make sure it's the parent networkview and not a child
            remoteViewID           = _networkView.viewID;
            group                  = _networkView.group;
            authFlags              = _networkView._data.authFlags; // TODO: ugly hack to void authority permission check
            isInstantiatedRemotely = _networkView.isInstantiatedRemotely;

            proxyPrefab     = _networkView.proxyPrefab;
            ownerPrefab     = _networkView.ownerPrefab;
            serverPrefab    = _networkView.serverPrefab;
            cellAuthPrefab  = _networkView.cellAuthPrefab;
            cellProxyPrefab = _networkView.cellProxyPrefab;

            _initialData  = null;
            _handoverData = null;

            _isInstantiatable = false;
            _networkP2P       = null;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates and initializes a new instance of NetworkInstantiateArgs.
        /// </summary>
        /// <param name="position"></param>
        /// <param name="rotation"></param>
        /// <param name="viewID"></param>
        /// <param name="owner"></param>
        /// <param name="group"></param>
        /// <param name="proxyPrefab"></param>
        /// <param name="ownerPrefab"></param>
        /// <param name="serverPrefab"></param>
        /// <param name="cellAuthPrefab"></param>
        /// <param name="cellProxyPrefab"></param>
        /// <param name="authFlags"></param>
        /// <param name="isInstantiatedRemotely"></param>
        /// <param name="initialData"></param>
        public NetworkInstantiateArgs(Vector3 position, Quaternion rotation, NetworkViewID viewID, NetworkPlayer owner, NetworkGroup group, string proxyPrefab, string ownerPrefab, string serverPrefab, string cellAuthPrefab, string cellProxyPrefab, NetworkAuthFlags authFlags, bool isInstantiatedRemotely, BitStream initialData)
        {
            this.position = position;
            this.rotation = rotation;

            data = new NetworkViewData(viewID, owner, group, authFlags, isInstantiatedRemotely, proxyPrefab, ownerPrefab, serverPrefab, cellAuthPrefab, cellProxyPrefab, initialData);
        }
Ejemplo n.º 5
0
 public TComponent Instantiate <TComponent>(NetworkViewID viewID, NetworkPlayer owner, TComponent proxyPrefab, TComponent ownerPrefab, TComponent serverPrefab, TComponent cellAuthPrefab, TComponent cellProxyPrefab, NetworkAuthFlags authFlags, Vector3 position, Quaternion rotation, NetworkGroup group, params object[] initialData) where TComponent : Component
 {
     return(_GetComponent <TComponent>(base.Instantiate(viewID, owner, proxyPrefab.GetNameNullSafe(), ownerPrefab.GetNameNullSafe(), serverPrefab.GetNameNullSafe(), cellAuthPrefab.GetNameNullSafe(), cellProxyPrefab.GetNameNullSafe(), authFlags, position, rotation, group, initialData)));
 }
Ejemplo n.º 6
0
 public GameObject Instantiate(NetworkViewID viewID, NetworkPlayer owner, GameObject proxyPrefab, GameObject ownerPrefab, GameObject serverPrefab, GameObject cellAuthPrefab, GameObject cellProxyPrefab, NetworkAuthFlags authFlags, Vector3 position, Quaternion rotation, NetworkGroup group, params object[] initialData)
 {
     return(_GetGameObject(base.Instantiate(viewID, owner, proxyPrefab.GetNameNullSafe(), ownerPrefab.GetNameNullSafe(), serverPrefab.GetNameNullSafe(), cellAuthPrefab.GetNameNullSafe(), cellProxyPrefab.GetNameNullSafe(), authFlags, position, rotation, group, initialData)));
 }
Ejemplo n.º 7
0
 public new GameObject Instantiate(NetworkViewID viewID, NetworkPlayer owner, string proxyPrefab, string ownerPrefab, string serverPrefab, string cellAuthPrefab, string cellProxyPrefab, NetworkAuthFlags authFlags, Vector3 position, Quaternion rotation, NetworkGroup group, params object[] initialData)
 {
     return(_GetGameObject(base.Instantiate(viewID, owner, proxyPrefab, ownerPrefab, serverPrefab, cellAuthPrefab, cellProxyPrefab, authFlags, position, rotation, group, initialData)));
 }