コード例 #1
0
        public void Start( )
        {
            if( _started )
            {
                return ;
            }

            _propertyInfo=_propertiesThisAppliesTo.GetType( ).GetProperty( _behaviourProperties.NameOfPropertyToModify ) ;

            _originalValue = _propertyInfo.GetValue( _propertiesThisAppliesTo, null ) ;

            _tweener = new Vector2Tweener(
                _behaviourProperties.From.AsVector2(  ),
                _behaviourProperties.To.AsVector2(  ),
                TimeSpan.FromSeconds( _behaviourProperties.DurationInSeconds ),
                Tweener.CreateTweeningFunction(
                    Type.GetType( _behaviourProperties.ClrTypeOfInterpolator ), _behaviourProperties.Easing ) ) ;

            _started = true ;
        }
コード例 #2
0
        public void Start( )
        {
            if( _started )
            {
                return ;
            }

            _propertyInfo=_propertiesThisAppliesTo.GetType( ).GetProperty( _behaviourProperties.NameOfPropertyToModify ) ;

            if( _propertyInfo.PropertyType != typeof( Vector2 ) )
            {
                throw new InvalidOperationException(@"Only Vector2 properties are valid for animating positions.");
            }

            _originalValue = _propertyInfo.GetValue( _propertiesThisAppliesTo, null ) ;

            _tweener = new Vector2Tweener(
                _behaviourProperties.From,
                _behaviourProperties.To,
                TimeSpan.FromSeconds( _behaviourProperties.DurationInSeconds ),
                Tweener.CreateTweeningFunction(
                    Type.GetType( _behaviourProperties.ClrTypeOfInterpolator ), _behaviourProperties.Easing ) ) ;

            _started = true ;
        }