using UnityEngine;
using System.Collections;
public class NetworkTime : TNetBehaviour
{
public static float time = 0f;
void Start()
{
time = Time.realtimeSinceStartup;
}
void Update()
{
time += Time.deltaTime;
}
void OnNetworkPlayerJoin( TNet.Player player )
{
if( TNManager.isHosting )
tnObject.Send( "SynchronizeTime", player, time );
}
[TNet.RFC]
public void SynchronizeTime( float t )
{
float pingSeconds = (float)TNManager.ping / 1000f;
NetworkTime.time = t + ( pingSeconds + 0.5f );
}
}