Ejemplo n.º 1
0
        private Transform CreatePipeline(CinemachineVirtualCamera copyFrom)
        {
            CinemachineComponentBase[] array = null;
            if (copyFrom != null)
            {
                copyFrom.InvalidateComponentPipeline();
                array = copyFrom.GetComponentPipeline();
            }
            Transform result;

            if (CinemachineVirtualCamera.CreatePipelineOverride != null)
            {
                result = CinemachineVirtualCamera.CreatePipelineOverride(this, "cm", array);
            }
            else
            {
                GameObject gameObject = new GameObject("cm");
                gameObject.transform.parent = base.transform;
                gameObject.AddComponent <CinemachinePipeline>();
                result = gameObject.transform;
                if (array != null)
                {
                    foreach (CinemachineComponentBase component in array)
                    {
                        ReflectionHelpers.CopyFields(component, gameObject.AddComponent(component.GetType()), BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
                    }
                }
            }
            base.PreviousStateIsValid = false;
            return(result);
        }