zoukankan      html  css  js  c++  java
  • Unity5.1 新的网络引擎UNET(十五) Networking 引用--下

    

    孙广东 2015.7.21

    本节提供了与网络系统一起使用的组件的具体信息。

    10、Network Proximity Checker

     
    NetworkProximityChecker 是一个组件,它能够用来控制 网络client,基于网络玩家 接近的对照度的对象。若要使用它。请将该组件放在一定范围内可见的对象上。此类依赖于物理计算的可见性。

    Properties

    Property:Function:
    visRangeThe range that the object should be visible in.
    visUpdateIntervalhow often in seconds the object should check for players entering it’s visible range.
    checkMethodWhich type of physics to use for proximity checking.
    Network Manager HUD
    NetworkReader


    11、NetworkReader

    NetworkReader 是一个用于从字节流中读取对象的 UNET 高级别 API 类。

    此类在与 NetworkWriter 一起工作。NetworkReader 具有很多Unity类型特定的序列化功能。


    12、NetworkServer

    NetworkServer 是一个 UNET 高级别 API 类,管理来自多个client的连接。

    Properties

    Property:Function:
    connectionsThe set of active connections to remote clients.
    localConnectionsThe set of active connections to local clients.
    handlersThe set of registered message handler function.
    objectsThe set of spawned objects with NetworkIdentities.
    activeTrue if the server is listening and running (static).
    localActiveClientTrue if there is a local client in the same process; this server is a “Host”.
    numChannelsThe number of configured NetworkTransport QoS channels.

    13、NetworkStartPosition

    NetworkStartPosition 被NetworkManager 使用,当创建player对象时。NetworkStartPosition的位置 和 旋转 用来放新创建的Player 对象。


    14、NetworkTransform

    NetworkTransform 组件通过网络同步movemen运动的游戏对象。此组件考虑权威,所以 LocalPlayer 对象 (当中有地方当局) 同步他们的 position 从client到server。然后出去给其它客户机。

    其它对象 (与server授权机构) 同步他们从server到client的位置。


    若要使用此组件,请将其加入到您想要同步运动的预制或游戏的对象。该组件要求游戏对象具有 NetworkIdentity。请注意。必须催生网络的对象来同步。

    Properties

    Property:Function:
    transformSyncModeWhich synchronization method to use for position.
    sendIntervalHow often in seconds the object sends updates.
    syncRotationAxisWhich axis to use for rotation.
    rotationSyncCompressionWhat kind of compession to use for rotation.
    syncSpinFlag to sync angular velocity.
    movementThesholdThe threshold to not send position updates.
    snapThresholdThe threshold to “pop” instead of interpolate.
    interpolateRotationFactor to control rotation interpolation.
    interpolateMovementFactor to control movement interpolation.

    Hints

    • NetworkTransform的inspector有一个 NetworkSendRate 滑块   。对于被创建后不须要更新 - 如子弹的对象,将此滑块设置为零。


    15、NetworkTransformVisualizer

    NetworkTransformVisualizer 是一个有用程序utility 组件。同意可视化的内嵌使用 NetworkTransform 组件的对象。

    Properties

    Property:Function:
    VisualizerPrefabThe prefab of an object to create to visualize the target position.

    16、NetworkTransport

    NetworkTransport 是 UNET 低级别 API 接口。它是一个静态的类。


    17、NetworkWriter

    NetworkWriter 是一个 UNET 高级别 API 类,用于将对象写入字节流。

    此类在与 NetworkReader 一起工作。NetworkWriter 具有很多统一类型特定的序列化功能。


    NetworWriter 与 MessageBase 类用于使包括序列化的网络消息的字节数组。


    void SendMessage(short msgType, MessageBase msg, int channelId)
    {
        // write the message to a local buffer
        NetworkWriter writer = new NetworkWriter();
        writer.StartMessage(msgType);
        msg.Serialize(writer);
        writer.FinishMessage();
    
        myClient.SendWriter(writer, channelId);
    }








  • 相关阅读:
    CocoStudio UI 编辑器的使用
    脚本AI与脚本引擎
    Android 开发问题集合
    cocos2d-x之 CCSpriteBatchNode 用法总结
    图解VS2010打包全过程
    如何写详细设计文档
    母函数(Generating function)详解 — TankyWoo
    【DP_区间DP专辑】 zeroclock
    【DP_概率DP专辑】【from zeroclock's blog】
    【DP_树形DP专辑】【from zeroclock's blog】
  • 原文地址:https://www.cnblogs.com/gccbuaa/p/6728111.html
Copyright © 2011-2022 走看看