本文整理汇总了C#中KBEngine.MemoryStream.readFloat方法的典型用法代码示例。如果您正苦于以下问题:C# MemoryStream.readFloat方法的具体用法?C# MemoryStream.readFloat怎么用?C# MemoryStream.readFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KBEngine.MemoryStream
的用法示例。
在下文中一共展示了MemoryStream.readFloat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Client_onSetEntityPosAndDir
/*
服务端强制设置了玩家的坐标
例如:在服务端使用avatar.position=(0,0,0), 或者玩家位置与速度异常时会强制拉回到一个位置
*/
public void Client_onSetEntityPosAndDir(MemoryStream stream)
{
Int32 eid = stream.readInt32();
Entity entity = null;
if(!entities.TryGetValue(eid, out entity))
{
Dbg.ERROR_MSG("KBEngine::Client_onSetEntityPosAndDir: entity(" + eid + ") not found!");
return;
}
entity.position.x = stream.readFloat();
entity.position.y = stream.readFloat();
entity.position.z = stream.readFloat();
entity.direction.x = stream.readFloat();
entity.direction.y = stream.readFloat();
entity.direction.z = stream.readFloat();
Vector3 position = (Vector3)entity.getDefinedPropterty("position");
Vector3 direction = (Vector3)entity.getDefinedPropterty("direction");
Vector3 old_position = new Vector3(position.x, position.y, position.z);
Vector3 old_direction = new Vector3(direction.x, direction.y, direction.z);
position.x = entity.position.x;
position.y = entity.position.y;
position.z = entity.position.z;
direction.x = entity.direction.x;
direction.y = entity.direction.y;
direction.z = entity.direction.z;
entity.setDefinedPropterty("position", position);
entity.setDefinedPropterty("direction", direction);
_entityLastLocalPos = entity.position;
_entityLastLocalDir = entity.direction;
entity.set_direction(old_direction);
entity.set_position(old_position);
}
示例2: Client_onUpdateBasePosXZ
public void Client_onUpdateBasePosXZ(MemoryStream stream)
{
_entityServerPos.x = stream.readFloat();
_entityServerPos.z = stream.readFloat();
}
示例3: Client_onSetEntityPosAndDir
public void Client_onSetEntityPosAndDir(MemoryStream stream)
{
Int32 eid = stream.readInt32();
Entity entity = null;
if(!entities.TryGetValue(eid, out entity))
{
Dbg.ERROR_MSG("KBEngine::Client_onSetEntityPosAndDir: entity(" + eid + ") not found!");
return;
}
entity.position.x = stream.readFloat();
entity.position.y = stream.readFloat();
entity.position.z = stream.readFloat();
entity.direction.z = KBEMath.int82angle((SByte)stream.readFloat(), false) * 360 / ((float)System.Math.PI * 2);
entity.direction.y = KBEMath.int82angle((SByte)stream.readFloat(), false) * 360 / ((float)System.Math.PI * 2);
entity.direction.x = KBEMath.int82angle((SByte)stream.readFloat(), false) * 360 / ((float)System.Math.PI * 2);
Vector3 position = (Vector3)entity.getDefinedPropterty("position");
Vector3 direction = (Vector3)entity.getDefinedPropterty("direction");
position.x = entity.position.x;
position.y = entity.position.y;
position.z = entity.position.z;
direction.x = entity.direction.x;
direction.y = entity.direction.y;
direction.z = entity.direction.z;
Event.fire("set_direction", new object[]{entity});
Event.fire("set_position", new object[]{entity});
}
示例4: createFromStream
public override object createFromStream(MemoryStream stream)
{
UInt32 size = stream.readUint32();
if(4 != size)
{
Dbg.ERROR_MSG(string.Format("KBEDATATYPE_VECTOR4::createFromStream: size({0}) is error!", size));
}
return new Vector4(stream.readFloat(), stream.readFloat(), stream.readFloat(), stream.readFloat());
}
示例5: Client_onUpdateBaseDir
public void Client_onUpdateBaseDir(MemoryStream stream)
{
float yaw, pitch, roll;
yaw = stream.readFloat() * 360 / ((float)System.Math.PI * 2);
pitch = stream.readFloat() * 360 / ((float)System.Math.PI * 2);
roll = stream.readFloat() * 360 / ((float)System.Math.PI * 2);
var entity = player();
if (entity != null && entity.isControlled)
{
entity.direction.Set(roll, pitch, yaw);
Event.fireOut("set_direction", new object[]{entity});
entity.onUpdateVolatileData();
}
}
示例6: Client_onUpdateBasePos
/*
服务端更新玩家的基础位置, 客户端以这个基础位置加上便宜值计算出玩家周围实体的坐标
*/
public void Client_onUpdateBasePos(MemoryStream stream)
{
_entityServerPos.X = stream.readFloat();
_entityServerPos.Y = stream.readFloat();
_entityServerPos.Z = stream.readFloat();
}