Beispiel #1
0
    void Update()
    {
        if (requestDemoRestart)
        {
            requestDemoRestart = false;
            Debug.Log("Restart demo");
            BulletTime.Restart();
        }

        if (BulletTime.isEditing)
        {
            var sameLength   = Mathf.Approximately(prevSplineTimeLength, spline.timeLength);
            var samePosition = Vector3.Distance(transform.position, prevPosition) <= Mathf.Epsilon;
            if (spline != prevSpline || !sameLength || !samePosition)
            {
                UpdatePositionOnSpline();
            }

            if (camera)
            {
                cameraAnimation = camera.GetComponent <Animation>();
                // local animations must be disabled or not played automatically
                if (cameraAnimation && cameraAnimation.enabled && cameraAnimation.playAutomatically)
                {
                    cameraAnimation = null;
                }
                if (cameraAnimation && !cameraAnimation.clip)
                {
                    cameraAnimation = null;
                }

                if (localCameraAnimation.animation != cameraAnimation)
                {
                    localCameraAnimation.Reset(cameraAnimation);
                }

                localAudioListener = FindAudioListener(camera.gameObject);
            }
        }
    }