Exemplo n.º 1
0
        /// <summary>
        /// Set the target position of the transform component.
        /// ( Use this to use tweening )
        /// </summary>
        /// <param name="transformation_type_x" >Type of transformation on x</param>
        /// <param name="transformation_type_y" >Type of transformation on y</param>
        /// <param name="duration_x" >Duration of the transformation on x</param>
        /// <param name="duration_y" >Duration of the transformation on y</param>
        /// <param name="target" >Target position of the transform component</param>
        /// <returns>The current transform component</returns>
        public Transform SetTarget(ETransformTypes transformation_type_x, ETransformTypes transformation_type_y, int duration_x, int duration_y, ref Vector2 target)
        {
            this.TransformX = transformation_type_x;
            this.TransformY = transformation_type_y;

            this.TimerX    = 0;
            this.TimerY    = 0;
            this.DurationX = duration_x;
            this.DurationY = duration_y;
            this.Target    = target;

            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Set the velocity of the transform component.
        /// ( Defined the transform type to linear )
        /// </summary>
        /// <param name="x" >Velocity for x axe</param>
        /// <param name="y" >Velocity for y axe</param>
        /// <returns>The current transform component</returns>
        public Transform SetVelocity(float x, float y)
        {
            if (this.TransformX != ETransformTypes.LINEAR)
            {
                this.TransformX = ETransformTypes.LINEAR;
            }

            if (this.TransformY != ETransformTypes.LINEAR)
            {
                this.TransformY = ETransformTypes.LINEAR;
            }

            this.Target.X = x;
            this.Target.Y = y;

            return(this);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="type"></param>
        /// <param name="timer"></param>
        /// <param name="value"></param>
        /// <param name="target"></param>
        /// <param name="duration"></param>
        /// <returns></returns>
        private float GetTransform(ETransformTypes type, int timer, float value, float target, int duration)
        {
            switch (type)
            {
            case ETransformTypes.LINEAR: return(value + target);

            case ETransformTypes.EASE_IN_SIN: return(0f);

            case ETransformTypes.EASE_IN_EXPO: return(0f);

            case ETransformTypes.EASE_OUT_SIN: return(0f);

            case ETransformTypes.EASE_OUT_EXPO: return(0f);
            }

            return(value);
        }