当前位置: 首页>>代码示例>>C#>>正文


C# Bundle.writeUint8方法代码示例

本文整理汇总了C#中KBEngine.Bundle.writeUint8方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.writeUint8方法的具体用法?C# Bundle.writeUint8怎么用?C# Bundle.writeUint8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KBEngine.Bundle的用法示例。


在下文中一共展示了Bundle.writeUint8方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addToStream

		public override void addToStream(Bundle stream, object v)
		{
			stream.writeUint8(Convert.ToByte(v));
		}
开发者ID:kjdjpan,项目名称:kbengine_unity3d_plugins,代码行数:4,代码来源:DataTypes.cs

示例2: updatePlayerToServer

        /*
            更新当前玩家的位置与朝向到服务端, 可以通过开关_syncPlayer关闭这个机制
        */
        public void updatePlayerToServer()
        {
            if(!_args.syncPlayer || spaceID == 0)
            {
                return;
            }

            TimeSpan span = DateTime.Now - _lastUpdateToServerTime;

            if(span.Milliseconds < 50)
                return;

            Entity playerEntity = player();
            if(playerEntity == null || playerEntity.inWorld == false)
                return;

            _lastUpdateToServerTime = System.DateTime.Now;

            Vector3 position = playerEntity.position;
            Vector3 direction = playerEntity.direction;

            bool posHasChanged = Vector3.Distance(_entityLastLocalPos, position) > 0.001f;
            bool dirHasChanged = Vector3.Distance(_entityLastLocalDir, direction) > 0.001f;

            if(posHasChanged || dirHasChanged)
            {
                _entityLastLocalPos = position;
                _entityLastLocalDir = direction;

                Bundle bundle = new Bundle();
                bundle.newMessage(Message.messages["Baseapp_onUpdateDataFromClient"]);
                bundle.writeFloat(position.x);
                bundle.writeFloat(position.y);
                bundle.writeFloat(position.z);

                bundle.writeFloat((float)((double)direction.x / 360 * 6.283185307179586));
                bundle.writeFloat((float)((double)direction.y / 360 * 6.283185307179586));
                bundle.writeFloat((float)((double)direction.z / 360 * 6.283185307179586));
                bundle.writeUint8((Byte)(playerEntity.isOnGround == true ? 1 : 0));
                bundle.writeUint32(spaceID);
                bundle.send(_networkInterface);
            }
        }
开发者ID:buckyu,项目名称:kbengine_unity3d_plugins,代码行数:46,代码来源:KBEngine.cs

示例3: updatePlayerToServer

        public void updatePlayerToServer()
        {
            Entity playerEntity = player();
            if(playerEntity == null || playerEntity.inWorld == false)
                return;

            Vector3 position = playerEntity.position;
            Vector3 direction = playerEntity.direction;

            Bundle bundle = new Bundle();
            bundle.newMessage(Message.messages["Baseapp_onUpdateDataFromClient"]);
            bundle.writeFloat(position.x);
            bundle.writeFloat(position.y);
            bundle.writeFloat(position.z);
            bundle.writeFloat(direction.z);
            bundle.writeFloat(direction.y);
            bundle.writeFloat(direction.x);
            bundle.writeUint8((Byte)(playerEntity.isOnGound == true ? 1 : 0));
            bundle.send(networkInterface_);
        }
开发者ID:hellopcworld,项目名称:kbengine,代码行数:20,代码来源:KBEngine.cs


注:本文中的KBEngine.Bundle.writeUint8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。