Example #1
0
 public TranslationSineLerpController(string id, ControllerType controllerType,
                                      Vector3 lerpDirection,
                                      TrigonometricParameters trigonometricParameters)
     : base(id, controllerType, trigonometricParameters)
 {
     this.LerpDirection = lerpDirection;
 }
Example #2
0
 public ColorSineLerpController(string id,
                                ControllerType controllerType,
                                Color startColor, Color endColor, TrigonometricParameters trigonometricParameters)
     : base(id, controllerType, trigonometricParameters)
 {
     this.startColor = startColor;
     this.endColor   = endColor;
 }
 public UIColorSineLerpController(string id, ControllerType controllerType, TrigonometricParameters trigonometricParameters,
                                  Color colorMin, Color colorMax)
     : base(id, controllerType)
 {
     this.TrigonometricParameters = trigonometricParameters;
     this.colorMin = colorMin;
     this.colorMax = colorMax;
 }
Example #4
0
        //lerps along a sine wave with properties defined by TrigonometricParameters (i.e. max amplitude, phase, speed) - see UISineLerpController
        public static float SineLerpByElapsedTime(TrigonometricParameters trigonometricParameters, float totalElapsedTime)
        {
            //range - max amplitude -> + max amplitude
            float lerpFactor = (float)(trigonometricParameters.MaxAmplitude
                                       * Math.Sin(trigonometricParameters.AngularFrequency
                                                  * MathHelper.ToRadians(totalElapsedTime) + MathHelper.ToRadians(trigonometricParameters.PhaseAngle)));

            //range 0 -> 2* max amplitude
            lerpFactor += trigonometricParameters.MaxAmplitude;
            //range 0 -> max amplitude
            lerpFactor /= 2.0f;

            return(lerpFactor);
        }
Example #5
0
        //lerps along a sine wave with properties defined by TrigonometricParameters (i.e. max amplitude, phase, speed) - see UISineLerpController
        public static float Sin(TrigonometricParameters trigonometricParameters, float totalElapsedTime)
        {
            //range - max amplitude -> + max amplitude
            float sin = (float)(trigonometricParameters.MaxAmplitude
                                * Math.Sin(trigonometricParameters.AngularFrequency
                                           * MathHelper.ToRadians(totalElapsedTime) + trigonometricParameters.PhaseAngle));

            //range 0 -> 2* max amplitude
            sin += trigonometricParameters.MaxAmplitude;

            //range 0 -> max amplitude
            sin /= 2.0f;

            return(sin);
        }
Example #6
0
        public override void Update(GameTime gameTime, IActor actor)
        {
            DrawnActor2D parentActor = actor as DrawnActor2D;



            if (parentActor.Transform.Bounds.Intersects(this.mouseManager.Bounds))
            {
                TrigonometricParameters trig = new TrigonometricParameters(1, 0.1f);
                this.totalElapsedTime += gameTime.ElapsedGameTime.Milliseconds;

                float lerpFactor = MathUtility.Sin(trig, this.totalElapsedTime);

                parentActor.Color           = MathUtility.Lerp(Color.Red, Color.Blue, lerpFactor);
                parentActor.Transform.Scale = MathUtility.Lerp(parentActor.Transform.Scale * 0.999f, parentActor.Transform.Scale * 1.001f, lerpFactor);
                Console.WriteLine(parentActor.Transform.Scale);

                if (this.mouseManager.IsLeftButtonClicked())
                {
                    if (parentActor.ID.Equals("menu1"))
                    {
                        EventDispatcher.Publish(new EventData("options", null, EventActionType.OnNewMenu, EventCategoryType.Menu));
                    }
                    else if (parentActor.ID.Equals("exit1"))
                    {
                        exit = true;
                    }
                }
            }
            else
            {
                parentActor.Transform.Scale = parentActor.Transform.OriginalTransform2D.Scale;
                parentActor.Color           = parentActor.OriginalColor;
            }

            base.Update(gameTime, actor);
        }
 public UIScaleSineLerpController(string id, ControllerType controllerType, TrigonometricParameters trigonometricParameters)
     : base(id, controllerType)
 {
     this.TrigonometricParameters = trigonometricParameters;
 }