Beispiel #1
0
    void LateUpdate()
    {
        // Using late update so that the position values we send are taken after all possible calculations (physics, etc).

        if (!_instantiated)
        {
            if (!_commandSender.isConnected())
            {
                return;
            }

            // Initialise the GRETA environment if it hasn't been done before.
            foreach (GameObject synchronizedObject in synchronizedObjects)
            {
                _commandSender.NotifyObject(synchronizedObject);
                synchronizedObject.transform.hasChanged = false;
            }

            _instantiated = true;
        }
        else
        {
            foreach (GameObject synchronizedObject in synchronizedObjects)
            {
                // If the synchronized object has changed since the last frame, update the GRETA Environment.
                if (synchronizedObject.transform.hasChanged)
                {
                    _commandSender.NotifyObject(synchronizedObject);
                    synchronizedObject.transform.hasChanged = false;
                }
            }
        }
    }