本文整理汇总了C#中RemoteEntityWorld类的典型用法代码示例。如果您正苦于以下问题:C# RemoteEntityWorld类的具体用法?C# RemoteEntityWorld怎么用?C# RemoteEntityWorld使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RemoteEntityWorld类属于命名空间,在下文中一共展示了RemoteEntityWorld类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Client_ReceiveSoundPlayTake
void Client_ReceiveSoundPlayTake( RemoteEntityWorld sender, ReceiveDataReader reader )
{
if( !reader.Complete() )
return;
SoundPlay3D( Type.SoundTake, .5f, true );
}
示例2: Server_SendBodiesPositionsToNewClient
void Server_SendBodiesPositionsToNewClient( RemoteEntityWorld remoteEntityWorld )
{
SendDataWriter writer = BeginNetworkMessage( remoteEntityWorld, typeof( Dynamic ),
(ushort)NetworkMessages.BodiesPositionsToClient );
//write body count
writer.WriteVariableUInt32( (uint)PhysicsModel.Bodies.Length );
//write bodies positions and rotations
foreach( Body body in PhysicsModel.Bodies )
{
writer.Write( true );
writer.Write( body.Position );
writer.Write( true );
writer.Write( body.Rotation, 16 );
}
EndNetworkMessage();
}
示例3: Server_OnClientConnectedAfterPostCreate
protected override void Server_OnClientConnectedAfterPostCreate(
RemoteEntityWorld remoteEntityWorld)
{
base.Server_OnClientConnectedAfterPostCreate( remoteEntityWorld );
if( Life != Type.LifeMax )
Server_SendLifeToClients( new RemoteEntityWorld[] { remoteEntityWorld } );
}
示例4: Client_ReceiveBodiesPositions
void Client_ReceiveBodiesPositions( RemoteEntityWorld sender, ReceiveDataReader reader )
{
//clear snapshots cache if entity is not created
if( !IsPostCreated )
client_receivePositionsSnapshots.Clear();
//check for invalid snapshot cache
if( client_receivePositionsSnapshots.Count != 0 )
{
Client_ReceivePositionsSnapshot lastSnapshot = client_receivePositionsSnapshots[
client_receivePositionsSnapshots.Count - 1 ];
if( lastSnapshot.bodies == null )
{
//remove snapshot cache
client_receivePositionsSnapshots.Clear();
}
}
int count = (int)reader.ReadVariableUInt32();
Client_ReceivePositionsSnapshot snapshot = new Client_ReceivePositionsSnapshot();
snapshot.networkTickNumber = EntitySystemWorld.Instance.NetworkTickCounter;
snapshot.bodies = new Client_ReceivePositionsSnapshot.BodyItem[ count ];
//receive bodies positions and rotations
for( int n = 0; n < count; n++ )
{
Client_ReceivePositionsSnapshot.BodyItem bodyItem = new
Client_ReceivePositionsSnapshot.BodyItem();
//read position
if( reader.ReadBoolean() )
{
bodyItem.position = reader.ReadVec3();
}
else
{
//get position from previous snapshot
if( client_receivePositionsSnapshots.Count != 0 )
{
bodyItem.position = client_receivePositionsSnapshots[
client_receivePositionsSnapshots.Count - 1 ].bodies[ n ].position;
}
}
//read rotation
if( reader.ReadBoolean() )
{
bodyItem.rotation = reader.ReadQuat( 16 );
}
else
{
//get rotation from previous snapshot
if( client_receivePositionsSnapshots.Count != 0 )
{
bodyItem.rotation = client_receivePositionsSnapshots[
client_receivePositionsSnapshots.Count - 1 ].bodies[ n ].rotation;
}
}
snapshot.bodies[ n ] = bodyItem;
}
if( !reader.Complete() )
return;
client_receivePositionsSnapshots.Add( snapshot );
if( IsPostCreated )
Client_UpdatePositionsBySnapshots( false );
}
示例5: Client_ReceivePositions
void Client_ReceivePositions( RemoteEntityWorld sender, ReceiveDataReader reader )
{
//clear snanshots cache if entity is not created
if( !IsPostCreated )
client_receivePositionsSnapshots.Clear();
//check for invalid snapshot cache
if( client_receivePositionsSnapshots.Count != 0 )
{
Client_ReceivePositionsSnapshot lastSnapshot = client_receivePositionsSnapshots[
client_receivePositionsSnapshots.Count - 1 ];
if( lastSnapshot.bodies != null )
{
//remove snapshot cache
client_receivePositionsSnapshots.Clear();
}
}
Client_ReceivePositionsSnapshot snapshot = new Client_ReceivePositionsSnapshot();
snapshot.networkTickNumber = EntitySystemWorld.Instance.NetworkTickCounter;
//read position
if( reader.ReadBoolean() )
{
snapshot.position = reader.ReadVec3();
}
else
{
//get position from previous snapshot
if( client_receivePositionsSnapshots.Count != 0 )
{
snapshot.position = client_receivePositionsSnapshots[
client_receivePositionsSnapshots.Count - 1 ].position;
}
}
//read rotation
if( reader.ReadBoolean() )
{
snapshot.rotation = reader.ReadQuat( 16 );
}
else
{
//get rotation from previous snapshot
if( client_receivePositionsSnapshots.Count != 0 )
{
snapshot.rotation = client_receivePositionsSnapshots[
client_receivePositionsSnapshots.Count - 1 ].rotation;
}
}
//read scale
if( reader.ReadBoolean() )
{
snapshot.scale = reader.ReadVec3();
}
else
{
//get position from previous snapshot
if( client_receivePositionsSnapshots.Count != 0 )
{
snapshot.scale = client_receivePositionsSnapshots[
client_receivePositionsSnapshots.Count - 1 ].scale;
}
}
if( !reader.Complete() )
return;
client_receivePositionsSnapshots.Add( snapshot );
Client_UpdatePositionsBySnapshots( false );
}
示例6: Server_OnClientConnectedBeforePostCreate
protected override void Server_OnClientConnectedBeforePostCreate(
RemoteEntityWorld remoteEntityWorld)
{
base.Server_OnClientConnectedBeforePostCreate(remoteEntityWorld);
Server_SendOpenSettingsToClients(new RemoteEntityWorld[] { remoteEntityWorld });
}
示例7: Client_ReceiveFaction
void Client_ReceiveFaction(RemoteEntityWorld sender, ReceiveDataReader reader)
{
string s = reader.ReadString();
if (!reader.Complete())
return;
text = s;
}
示例8: Client_ReceiveMoveFinish
void Client_ReceiveMoveFinish( RemoteEntityWorld sender, ReceiveDataReader reader )
{
bool putToDestinationPlace = reader.ReadBoolean();
bool completePuzzle = reader.ReadBoolean();
if( !reader.Complete() )
return;
client_movingByUser = null;
//play sounds
if( putToDestinationPlace )
ClientOrSingle_SoundPlay( "Maps\\JigsawPuzzleGame\\PutToDestinationPlace.ogg" );
if( completePuzzle )
ClientOrSingle_SoundPlay( "Maps\\JigsawPuzzleGame\\CompletePuzzle.ogg" );
}
示例9: Client_ReceivePosition
void Client_ReceivePosition( RemoteEntityWorld sender, ReceiveDataReader reader )
{
Vec3 value = reader.ReadVec3();
if( !reader.Complete() )
return;
Position = value;
}
示例10: Client_ReceiveIndex
void Client_ReceiveIndex( RemoteEntityWorld sender, ReceiveDataReader reader )
{
Vec2I value = reader.ReadVec2I();
if( !reader.Complete() )
return;
index = value;
}
示例11: Client_ReceiveMoveBegin
void Client_ReceiveMoveBegin( RemoteEntityWorld sender, ReceiveDataReader reader )
{
uint userId = reader.ReadVariableUInt32();
if( !reader.Complete() )
return;
UserManagementClientNetworkService userService = GameNetworkClient.Instance.
UserManagementService;
client_movingByUser = userService.GetUser( userId );
}
示例12: Server_OnClientDisconnected
protected override void Server_OnClientDisconnected( RemoteEntityWorld remoteEntityWorld )
{
base.Server_OnClientDisconnected( remoteEntityWorld );
//finish moving when user disconnected
if( serverOrSingle_Moving )
{
EntitySystemServerNetworkService.ClientRemoteEntityWorld clientRemoteEntityWorld =
(EntitySystemServerNetworkService.ClientRemoteEntityWorld)remoteEntityWorld;
UserManagementServerNetworkService.UserInfo user = clientRemoteEntityWorld.User;
if( user == server_movingByUser )
{
ServerOrSingle_MoveFinish();
}
}
}
示例13: Server_OnClientConnectedBeforePostCreate
///////////////////////////////////////////
// Server side
///////////////////////////////////////////
protected override void Server_OnClientConnectedBeforePostCreate(
RemoteEntityWorld remoteEntityWorld )
{
base.Server_OnClientConnectedBeforePostCreate( remoteEntityWorld );
RemoteEntityWorld[] array = new RemoteEntityWorld[] { remoteEntityWorld };
//send Index to the connected remote world
Server_SendIndexToClients( array );
//send Position to the connected remote world
Server_SendPositionToClients( array );
}
示例14: Server_SendPositionToNewClient
void Server_SendPositionToNewClient( RemoteEntityWorld remoteEntityWorld )
{
SendDataWriter writer = BeginNetworkMessage( remoteEntityWorld, typeof( Item ),
(ushort)NetworkMessages.PositionToClient );
writer.Write( Position );
EndNetworkMessage();
}
示例15: Client_ReceiveReloadEvent
void Client_ReceiveReloadEvent( RemoteEntityWorld sender, ReceiveDataReader reader )
{
if( !reader.Complete() )
return;
OnReload();
}