Пример #1
0
        internal static void ApplyParameters(InertiaExpansionBehavior behavior, InertiaProcessor2D processor, Vector initialVelocity)
        {
            if (behavior != null && behavior.CanUseForInertia())
            {
                InertiaExpansionBehavior2D behavior2D = new InertiaExpansionBehavior2D();
                if (behavior._isInitialVelocitySet)
                {
                    behavior2D.InitialVelocityX = (float)behavior._initialVelocity.X;
                    behavior2D.InitialVelocityY = (float)behavior._initialVelocity.Y;
                }
                else
                {
                    behavior2D.InitialVelocityX = (float)initialVelocity.X;
                    behavior2D.InitialVelocityY = (float)initialVelocity.Y;
                }
                if (behavior._isDesiredDecelerationSet)
                {
                    behavior2D.DesiredDeceleration = (float)behavior._desiredDeceleration;
                }
                if (behavior._isDesiredExpansionSet)
                {
                    behavior2D.DesiredExpansionX = (float)behavior._desiredExpansion.X;
                    behavior2D.DesiredExpansionY = (float)behavior._desiredExpansion.Y;
                }
                if (behavior._isInitialRadiusSet)
                {
                    behavior2D.InitialRadius = (float)behavior._initialRadius;
                }

                processor.ExpansionBehavior = behavior2D;
            }
        }
Пример #2
0
        internal static void ApplyParameters(InertiaExpansionBehavior behavior, InertiaProcessor2D processor, Vector initialVelocity)
        {
            if (behavior != null && behavior.CanUseForInertia())
            {
                InertiaExpansionBehavior2D behavior2D = new InertiaExpansionBehavior2D();
                if (behavior._isInitialVelocitySet)
                {
                    behavior2D.InitialVelocityX = (float)behavior._initialVelocity.X;
                    behavior2D.InitialVelocityY = (float)behavior._initialVelocity.Y;
                }
                else
                {
                    behavior2D.InitialVelocityX = (float)initialVelocity.X;
                    behavior2D.InitialVelocityY = (float)initialVelocity.Y;
                }
                if (behavior._isDesiredDecelerationSet)
                {
                    behavior2D.DesiredDeceleration = (float)behavior._desiredDeceleration;
                }
                if (behavior._isDesiredExpansionSet)
                {
                    behavior2D.DesiredExpansionX = (float)behavior._desiredExpansion.X;
                    behavior2D.DesiredExpansionY = (float)behavior._desiredExpansion.Y;
                }
                if (behavior._isInitialRadiusSet)
                {
                    behavior2D.InitialRadius = (float)behavior._initialRadius;
                }

                processor.ExpansionBehavior = behavior2D;
            }
        }