void OnMessageConnectionApproved( BitReader reader ) { int ourIndex = reader.Packed<Int32>(); _localIndex = new NodeIndex( (uint)ourIndex ); _networkTime = reader.Packed<float>(); // TODO: cozeroff // not sure what we do with the network timestamp for now int networkTimestamp = reader.Packed<Int32>(); // spawn entities already existing in the world int entityCount = reader.Packed<Int32>(); Entity.Spawn s = new Entity.Spawn(); for( int i = 0; i < entityCount; ++i ) { s.Read( reader ); SpawnEntityClient( s ); } _status = Status.Connected; }
void OnEntityCreate( BitReader reader ) { Entity.Spawn spawn = new Entity.Spawn(); spawn.Read( reader ); SpawnEntityClient( spawn ); }