Exemple #1
0
    internal void RegisterCamera(AmplifyMotionCamera camera)
    {
        Camera actual = camera.GetComponent <Camera>();

        if ((actual.cullingMask & (1 << gameObject.layer)) != 0 && !m_states.ContainsKey(actual))
        {
            AmplifyMotion.MotionState state = null;
            switch (m_type)
            {
            case AmplifyMotion.ObjectType.Solid:
                state = new AmplifyMotion.SolidState(camera, this); break;

            case AmplifyMotion.ObjectType.Skinned:
                state = new AmplifyMotion.SkinnedState(camera, this); break;

            case AmplifyMotion.ObjectType.Cloth:
                state = new AmplifyMotion.ClothState(camera, this); break;

                        #if !UNITY_PRE_5_3
            case AmplifyMotion.ObjectType.Particle:
                state = new AmplifyMotion.ParticleState(camera, this); break;
                        #endif
            default:
                throw new Exception("[AmplifyMotion] Invalid object type.");
            }

            camera.RegisterObject(this);

            m_states.Add(actual, state);
        }
    }
Exemple #2
0
    internal void RegisterCamera(AmplifyMotionCamera camera)
    {
        Camera actual = camera.GetComponent <Camera>();

        if ((actual.cullingMask & (1 << gameObject.layer)) != 0 && !m_states.ContainsKey(actual))
        {
            MotionState state = null;
            switch (m_type)
            {
            case AmplifyMotionObjectType.Solid:
                state = new AmplifyMotion.SolidState(camera, this); break;

            case AmplifyMotionObjectType.Skinned:
                state = new AmplifyMotion.SkinnedState(camera, this); break;

                        #if UNITY_3 || UNITY_4
            case AmplifyMotionObjectType.Cloth:
                state = new AmplifyMotion.ClothState(camera, this); break;
                        #endif
            default:
                throw new Exception("[AmplifyMotion] Invalid object type.");
            }

            m_fixedStep = false;
                #if UNITY_3 || UNITY_4
            if (m_type == AmplifyMotionObjectType.Cloth)
            {
                m_fixedStep = true;
            }
            else if (m_type == AmplifyMotionObjectType.Solid)
                #else
            if (m_type == AmplifyMotionObjectType.Solid)
                #endif
            {
                Rigidbody rb = GetComponent <Rigidbody>();
                if (rb != null && rb.interpolation == RigidbodyInterpolation.None)
                {
                    m_fixedStep = true;
                }
            }

            camera.RegisterObject(this);

            m_states.Add(actual, state);
        }
    }
	internal void RegisterCamera( AmplifyMotionCamera camera )
	{
		Camera actual = camera.GetComponent<Camera>();
		if ( ( actual.cullingMask & ( 1 << gameObject.layer ) ) != 0 && !m_states.ContainsKey( actual ) )
		{
			AmplifyMotion.MotionState state = null;
			switch ( m_type )
			{
				case AmplifyMotion.ObjectType.Solid:
					state = new AmplifyMotion.SolidState( camera, this ); break;
				case AmplifyMotion.ObjectType.Skinned:
					state = new AmplifyMotion.SkinnedState( camera, this );	break;
				case AmplifyMotion.ObjectType.Cloth:
					state = new AmplifyMotion.ClothState( camera, this ); break;
			#if !UNITY_PRE_5_3
				case AmplifyMotion.ObjectType.Particle:
					state = new AmplifyMotion.ParticleState( camera, this ); break;
			#endif
				default:
					throw new Exception( "[AmplifyMotion] Invalid object type." );
			}

			camera.RegisterObject( this );

			m_states.Add( actual, state );
		}
	}
	internal void RegisterCamera( AmplifyMotionCamera camera )
	{
		Camera actual = camera.GetComponent<Camera>();
		if ( ( actual.cullingMask & ( 1 << gameObject.layer ) ) != 0 && !m_states.ContainsKey( actual ) )
		{
			MotionState state =null;
			switch ( m_type )
			{
				case AmplifyMotionObjectType.Solid:
					state = new AmplifyMotion.SolidState( camera, this ); break;
				case AmplifyMotionObjectType.Skinned:
					state = new AmplifyMotion.SkinnedState( camera, this );	break;
			#if UNITY_3 || UNITY_4
				case AmplifyMotionObjectType.Cloth:
					state = new AmplifyMotion.ClothState( camera, this ); break;
			#endif
				default:
					throw new Exception( "[AmplifyMotion] Invalid object type." );
			}

			m_fixedStep = false;
		#if UNITY_3 || UNITY_4
			if ( m_type == AmplifyMotionObjectType.Cloth )
				m_fixedStep = true;
			else if ( m_type == AmplifyMotionObjectType.Solid )
		#else
			if ( m_type == AmplifyMotionObjectType.Solid )
		#endif
			{
				Rigidbody rb = GetComponent<Rigidbody>();
				if ( rb != null && rb.interpolation == RigidbodyInterpolation.None )
					m_fixedStep = true;
			}

			camera.RegisterObject( this );

			m_states.Add( actual, state );
		}		
	}