Example #1
0
 /// <summary>
 /// Create the rotation animator.
 /// </summary>
 /// <param name="properties">Base animator properties.</param>
 /// <param name="rotationDirection">Base rotation direction vector.</param>
 /// <param name="speed">Rotation speed.</param>
 public RotationAnimator(BaseAnimatorProperties properties, Vector3 rotationDirection, float speed = 1f) : base(properties)
 {
     // set basic properties
     RotationDirection = rotationDirection;
     _directionJitter  = null;
     _minSpeed         = speed;
     _maxSpeed         = speed;
 }
Example #2
0
        /// <summary>
        /// Create base animation.
        /// </summary>
        /// <param name="properties">Basic animator properties.</param>
        protected BaseAnimator(BaseAnimatorProperties properties)
        {
            // store properties
            BaseProperties = properties;

            // reset counters
            TimeAlive = 0f;
        }
Example #3
0
 /// <summary>
 /// Create the rotation animator for random direction.
 /// </summary>
 /// <param name="properties">Base animator properties.</param>
 /// <param name="speed">Rotation speed.</param>
 /// <param name="speedJitter">Optional speed jiterring.</param>
 public RotationAnimator(BaseAnimatorProperties properties, float speed = 1f, float speedJitter = 0f) : base(properties)
 {
     // set basic properties
     RotationDirection = Vector3.Zero;
     _directionJitter  = Vector3.One;
     _minSpeed         = speed;
     _maxSpeed         = speed + speedJitter;
 }
Example #4
0
 /// <summary>
 /// Create the color animator.
 /// </summary>
 /// <param name="properties">Basic animator properties.</param>
 /// <param name="fromColor">Starting color.</param>
 /// <param name="toColor">Ending color.</param>
 /// <param name="coloringTime">How long to transition from starting to ending color.</param>
 /// <param name="colorTimeJitter">If provided, will add random jitter to fading time.</param>
 /// <param name="startColorJitter">If provided, will add random shift to starting color. For example, if color (100, 0, 0) is set, will add random 0-100 to red component.</param>
 /// <param name="endColorJitter">If provided, will add random shift to ending color. For example, if color (100, 0, 0) is set, will add random 0-100 to red component.</param>
 public ColorAnimator(BaseAnimatorProperties properties, Color fromColor, Color toColor, float coloringTime,
                      float colorTimeJitter = 0f, Color?startColorJitter = null, Color?endColorJitter = null) : base(properties)
 {
     // set basic properties
     FromColor           = fromColor;
     ToColor             = toColor;
     ColoringTime        = coloringTime;
     _coloringTimeJitter = colorTimeJitter;
     _startColorJitter   = startColorJitter;
     _endColorJitter     = endColorJitter;
 }
Example #5
0
 /// <summary>
 /// Create the scale animator.
 /// </summary>
 /// <param name="properties">Basic animator properties.</param>
 /// <param name="fromScale">Starting scale.</param>
 /// <param name="toScale">Ending scale.</param>
 /// <param name="scaleTime">How long to transition from starting to ending scale.</param>
 /// <param name="scaleTimeJitter">If provided, will add random jitter to scaling time.</param>
 /// <param name="startScaleJitter">If provided, will add random jitter to scaling starting value.</param>
 /// /// <param name="endScaleJitter">If provided, will add random jitter to scaling ending value.</param>
 public ScaleAnimator(BaseAnimatorProperties properties, Vector3 fromScale, Vector3 toScale, float scaleTime,
                      float scaleTimeJitter = 0f, float startScaleJitter = 0f, float endScaleJitter = 0f) : base(properties)
 {
     // set basic properties
     FromScale         = fromScale;
     ToScale           = toScale;
     ScalingTime       = scaleTime;
     _endScaleJitter   = endScaleJitter;
     _scaleTimeJitter  = scaleTimeJitter;
     _startScaleJitter = startScaleJitter;
 }
Example #6
0
 /// <summary>
 /// Create the motion animator.
 /// </summary>
 /// <param name="properties">Base animator properties.</param>
 /// <param name="velocity">Starting velocity (movement vector).</param>
 /// <param name="acceleration">Acceleration force.</param>
 /// <param name="maxVelocity">If provided, will limit max velocity.</param>
 /// <param name="velocityJitter">Add random jittering to velocity size.</param>
 /// <param name="accelerationJitter">Add random jittering to acceleration size.</param>
 /// <param name="velocityDirectionJitter">Add random direction jitter to velocity.</param>
 /// <param name="accelerationDirectionJitter">Add random direction jitter to acceleration.</param>
 public MotionAnimator(BaseAnimatorProperties properties, Vector3 velocity, Vector3?acceleration = null,
                       float maxVelocity = 0f, float velocityJitter = 0f, float accelerationJitter = 0f,
                       Vector3?velocityDirectionJitter = null, Vector3?accelerationDirectionJitter = null) : base(properties)
 {
     // set basic properties
     Velocity                     = velocity;
     Acceleration                 = acceleration;
     MaxVelocity                  = maxVelocity;
     _velocityJitter              = velocityJitter;
     _accelerationJitter          = accelerationJitter;
     _velocityDirectionJitter     = velocityDirectionJitter;
     _accelerationDirectionJitter = accelerationDirectionJitter;
 }
Example #7
0
 /// <summary>
 /// Create the color animator with random colors.
 /// </summary>
 /// <param name="properties">Basic animator properties.</param>
 /// <param name="coloringTime">How long to transition from starting to ending color.</param>
 public ColorAnimator(BaseAnimatorProperties properties, float coloringTime) :
     this(properties, Color.Black, Color.Black, coloringTime, 0f, Color.White, Color.White)
 {
 }