示例#1
0
    void Update()
    {
        // If we aren't in a network room, network messages will just get lost. Don't do anything.
        if (!NetworkReady)
        {
            return;
        }

        // Initial sync needs to happen right away, but can't happen until we're in a network room
        if (!initialSync)
        {
            initialSync = true;
            SyncAll();
        }

        // Go through all the watches, and check if they need updated
        for (int i = 0; i < watches.Length; i++)
        {
            Watch watch = watches[i];
            if (watch.NeedsCheck() &&
                watch.HasChanged(NetworkTime))
            {
                DataChange(i, watch.GetCurrentValue());
            }
        }
    }