示例#1
0
    void UpdatePostProcess()
    {
        Camera highestReference = null;
        float  highestDepth     = -float.MaxValue;

        if (m_linkedCamerasChanged)
        {
            UpdateLinkedCameras();
        }

        for (int i = 0; i < m_linkedCameraKeys.Length; i++)
        {
            if (m_linkedCameraKeys[i].depth > highestDepth)
            {
                highestReference = m_linkedCameraKeys[i];
                highestDepth     = m_linkedCameraKeys[i].depth;
            }
        }

        if (m_currentPostProcess != null && m_currentPostProcess.gameObject != highestReference.gameObject)
        {
            DestroyImmediate(m_currentPostProcess);
            m_currentPostProcess = null;
        }

        if (m_currentPostProcess == null && highestReference != null && highestReference != GetComponent <Camera>())
        {
            CurrentInstance = this;

            AmplifyMotionPostProcess[] runtimes = gameObject.GetComponents <AmplifyMotionPostProcess>();
            if (runtimes != null && runtimes.Length > 0)
            {
                for (int i = 0; i < runtimes.Length; i++)
                {
                    DestroyImmediate(runtimes[i]);
                }
            }
            m_currentPostProcess = highestReference.gameObject.AddComponent <AmplifyMotionPostProcess>();

            CurrentInstance = null;
        }
    }
    private void UpdatePostProcess()
    {
        Camera camera = null;
        float  num    = -3.40282347E+38f;

        if (this.m_linkedCamerasChanged)
        {
            this.UpdateLinkedCameras();
        }
        for (int i = 0; i < this.m_linkedCameraKeys.Length; i++)
        {
            if (this.m_linkedCameraKeys[i] != null && this.m_linkedCameraKeys[i].isActiveAndEnabled && this.m_linkedCameraKeys[i].depth > num)
            {
                camera = this.m_linkedCameraKeys[i];
                num    = this.m_linkedCameraKeys[i].depth;
            }
        }
        if (this.m_currentPostProcess != null && this.m_currentPostProcess.gameObject != camera.gameObject)
        {
            UnityEngine.Object.DestroyImmediate(this.m_currentPostProcess);
            this.m_currentPostProcess = null;
        }
        if (this.m_currentPostProcess == null && camera != null && camera != this.m_camera)
        {
            AmplifyMotionPostProcess[] components = base.gameObject.GetComponents <AmplifyMotionPostProcess>();
            if (components != null && components.Length > 0)
            {
                for (int j = 0; j < components.Length; j++)
                {
                    UnityEngine.Object.DestroyImmediate(components[j]);
                }
            }
            this.m_currentPostProcess          = camera.gameObject.AddComponent <AmplifyMotionPostProcess>();
            this.m_currentPostProcess.Instance = this;
        }
    }
	void UpdatePostProcess()
	{
		Camera highestReference = null;
		float highestDepth = -float.MaxValue;

		if ( m_linkedCamerasChanged )
			UpdateLinkedCameras();

		for ( int i = 0; i < m_linkedCameraKeys.Length; i++ )
		{
			if ( m_linkedCameraKeys[ i ] != null && m_linkedCameraKeys[ i ].isActiveAndEnabled && m_linkedCameraKeys[ i ].depth > highestDepth )
			{
				highestReference = m_linkedCameraKeys[ i ];
				highestDepth = m_linkedCameraKeys[ i ].depth;
			}
		}

		if ( m_currentPostProcess != null && m_currentPostProcess.gameObject != highestReference.gameObject )
		{
			DestroyImmediate( m_currentPostProcess );
			m_currentPostProcess = null;
		}

		if ( m_currentPostProcess == null && highestReference != null && highestReference != m_camera )
		{
			AmplifyMotionPostProcess[] runtimes = gameObject.GetComponents<AmplifyMotionPostProcess>();
			if ( runtimes != null && runtimes.Length > 0 )
			{
				for ( int i = 0; i < runtimes.Length; i++ )
					DestroyImmediate( runtimes[ i ] );
			}
			m_currentPostProcess = highestReference.gameObject.AddComponent<AmplifyMotionPostProcess>();
			m_currentPostProcess.Instance = this;
		}
	}
 private void UpdatePostProcess()
 {
     Camera camera = null;
     float num = -3.40282347E+38f;
     if (this.m_linkedCamerasChanged)
     {
         this.UpdateLinkedCameras();
     }
     for (int i = 0; i < this.m_linkedCameraKeys.Length; i++)
     {
         if (this.m_linkedCameraKeys[i] != null && this.m_linkedCameraKeys[i].isActiveAndEnabled && this.m_linkedCameraKeys[i].depth > num)
         {
             camera = this.m_linkedCameraKeys[i];
             num = this.m_linkedCameraKeys[i].depth;
         }
     }
     if (this.m_currentPostProcess != null && this.m_currentPostProcess.gameObject != camera.gameObject)
     {
         UnityEngine.Object.DestroyImmediate(this.m_currentPostProcess);
         this.m_currentPostProcess = null;
     }
     if (this.m_currentPostProcess == null && camera != null && camera != this.m_camera)
     {
         AmplifyMotionPostProcess[] components = base.gameObject.GetComponents<AmplifyMotionPostProcess>();
         if (components != null && components.Length > 0)
         {
             for (int j = 0; j < components.Length; j++)
             {
                 UnityEngine.Object.DestroyImmediate(components[j]);
             }
         }
         this.m_currentPostProcess = camera.gameObject.AddComponent<AmplifyMotionPostProcess>();
         this.m_currentPostProcess.Instance = this;
     }
 }