public override VNetMessage Clone() { VNetMessageRunCoroutine clone = (VNetMessageRunCoroutine)base.Clone(); clone.networkID = networkID; clone.componentType = componentType; clone.coroutineName = coroutineName; clone.netTimeStart = netTimeStart; return(clone); }
public void OnRunCoroutineMessage(VNetMessageRunCoroutine message) { // Get out the object if (m_networkTransforms.ContainsKey(message.networkID) == false) { return; } double currentTime = VNetSessionTime.Inst.GetServerTimePrecise(); VNetTransform trans = m_networkTransforms [message.networkID]; MonoBehaviour comp = trans.GetComponent(message.componentType) as MonoBehaviour; StartCoroutine(StartCoroutineDelayed((float)(message.netTimeStart - currentTime), comp, message.coroutineName)); }
public void RunCoroutineSynced(MonoBehaviour component, string coroutineName) { // Get out the network transform name VNetTransform trans = component.GetComponent <VNetTransform>(); if (trans == null) { throw new UnityException("Can't run synced coroutine on object without a VNetTransform!"); } VNetMessageRunCoroutine message = new VNetMessageRunCoroutine(); message.networkID = trans.netIdentifier; message.componentType = component.GetType().ToString(); message.coroutineName = coroutineName; message.netTimeStart = VNetSessionTime.Inst.GetServerTimePrecise() + VNetManager.Inst.CoroutineStartDelay; VNet.Inst.SendToLobby(message, true); // delay the start of the coroutine here, too StartCoroutine(VNetTransformManager.Inst.StartCoroutineDelayed((float)VNetManager.Inst.CoroutineStartDelay, component, coroutineName)); }