Exemplo n.º 1
0
 public void Perform(float start, float end, float thickness, LerpHelper.Delegate lerp, ISlider slider)
 {
     Start = start;
     End   = end;
     Thickness.Set(thickness, 0, lerp, 1);
     Slider = slider;
 }
Exemplo n.º 2
0
 public ParticleRing(SceneGame world, float startRadius, float thickness, LerpHelper.Delegate innerLerp, LerpHelper.Delegate outerLerp, int time) : base(world, time)
 {
     Thickness   = thickness;
     StartRadius = startRadius;
     InnerLerp   = innerLerp;
     OuterLerp   = outerLerp;
 }
Exemplo n.º 3
0
 public void Set(T oldValue, T newValue, LerpHelper.Delegate lerp, float time)
 {
     Start = oldValue;
     End   = newValue;
     Frame = new Slider(time);
     Lerp  = lerp;
 }
Exemplo n.º 4
0
 public ParticleWave(SceneGame world, float startRadius, float thickness, LerpHelper.Delegate lerp, LerpHelper.Delegate colorLerp, int time) : base(world, time)
 {
     Thickness   = thickness;
     StartRadius = startRadius;
     Lerp        = lerp;
     ColorLerp   = colorLerp;
 }
Exemplo n.º 5
0
 public ParticleExplosion(SceneGame world, SpriteReference sprite, Vector2 velocity, LerpHelper.Delegate subImageLerp, LerpHelper.Delegate velocityLerp, int time) : base(world, time)
 {
     Sprite       = sprite;
     SubImageLerp = subImageLerp;
     Velocity     = velocity;
     VelocityLerp = velocityLerp;
 }
Exemplo n.º 6
0
 public ParticleBlob(SceneGame world, SpriteReference sprite, Vector2 velocity, LerpHelper.Delegate velocityLerp, LerpHelper.Delegate scaleLerp, int time) : base(world, time)
 {
     Sprite       = sprite;
     Velocity     = velocity;
     VelocityLerp = velocityLerp;
     ScaleLerp    = scaleLerp;
 }
 public void Wave(float start, float end, LerpHelper.Delegate lerp, ISlider slider)
 {
     VisualAmplitude = () =>
     {
         float slide = MathHelper.Clamp(slider.Slide, 0, 1);
         return((float)lerp(start, end, slide));
     };
 }
 public void ReelIn(Vector2 position, LerpHelper.Delegate lerp, ISlider slider)
 {
     VisualTip = () =>
     {
         float slide = MathHelper.Clamp(slider.Slide, 0, 1);
         return(Vector2.Lerp(position, GetBase(), (float)lerp(0, 1, slide)));
     };
 }
Exemplo n.º 9
0
 public ParticleSpore(SceneGame world, SpriteReference sprite, Vector2 start, Vector2 end, LerpHelper.Delegate velocityLerp, int time) : base(world, time)
 {
     Sprite       = sprite;
     Position     = start;
     Target       = end;
     VelocityLerp = velocityLerp;
     OffsetX      = Random.Next(sprite.Width);
     OffsetY      = Random.Next(sprite.Height);
 }
Exemplo n.º 10
0
 public ParticleThrow(SceneGame world, SpriteReference sprite, Vector2 start, Vector2 end, float height, LerpHelper.Delegate velocityLerp, LerpHelper.Delegate scaleLerp, int time, float fadeSlide) : base(world, time)
 {
     Sprite       = sprite;
     Position     = start;
     Target       = end;
     Height       = height;
     VelocityLerp = velocityLerp;
     ScaleLerp    = scaleLerp;
     FadeSlide    = fadeSlide;
 }
Exemplo n.º 11
0
        public void MoveVisual(Vector2 newPosition, LerpHelper.Delegate lerp, ISlider slider)
        {
            var oldPosition = VisualPosition();

            VisualPosition = () =>
            {
                float slide = MathHelper.Clamp(slider.Slide, 0, 1);
                return(Vector2.Lerp(oldPosition, newPosition, (float)lerp(0, 1, slide)));
            };
        }
Exemplo n.º 12
0
        public void OrientVisual(float newAngle, LerpHelper.Delegate lerp, ISlider slider)
        {
            var oldAngle = VisualAngle();

            VisualAngle = () =>
            {
                float slide = MathHelper.Clamp(slider.Slide, 0, 1);
                return((float)lerp(oldAngle, newAngle, slide));
            };
        }
Exemplo n.º 13
0
        public void SetScale(float newScale, LerpHelper.Delegate lerp, ISlider slider)
        {
            var oldScale = VisualScale();

            VisualScale = () =>
            {
                float slide = MathHelper.Clamp(slider.Slide, 0, 1);
                return((float)lerp(oldScale, newScale, slide));
            };
        }
Exemplo n.º 14
0
        public static bool MoveTo(this ICurio curio, MapTile tile, LerpHelper.Delegate lerp, ISlider slider)
        {
            var movable = curio.GetBehavior <BehaviorMovable>();

            if (movable != null)
            {
                movable.MoveTo(tile, lerp, slider);
                return(true);
            }
            return(false);
        }
Exemplo n.º 15
0
        public static bool MoveVisual(this ICurio curio, Vector2 newPosition, LerpHelper.Delegate lerp, ISlider slider)
        {
            var movable = curio.GetBehavior <BehaviorMovable>();

            if (movable != null)
            {
                movable.MoveVisual(newPosition, lerp, slider);
                return(true);
            }
            return(false);
        }
Exemplo n.º 16
0
 public void TurnTo(float angle, LerpHelper.Delegate lerp, ISlider slider)
 {
     SetAngle(angle);
     if (slider == null)
     {
         SetAngleVisual(angle);
     }
     else
     {
         TurnVisual(angle, lerp, slider);
     }
 }
Exemplo n.º 17
0
        public void OrientTo(int position, LerpHelper.Delegate lerp, ISlider slider)
        {
            SetPosition(position);
            var angle = GetAngle(Position);

            if (slider == null)
            {
                SetAngleVisual(angle);
            }
            else
            {
                OrientVisual(angle, lerp, slider);
            }
        }
Exemplo n.º 18
0
 public static void PowerDown(Cloak cloak, int modulo, ColorMatrix color, LerpHelper.Delegate scaleLerp, LerpHelper.Delegate colorLerp, int time)
 {
     if (cloak.Frame.Time % modulo == 0)
     {
         var afterimage = new ParticleAfterImageLocked(cloak.Creature, scaleLerp, colorLerp, time)
         {
             Position    = cloak.Creature.VisualPosition(),
             ColorMatrix = color,
             Scale       = 1f,
             ScaleEnd    = 2f,
             Pass        = DrawPass.Effect,
             Origin      = cloak.Creature.TopOffset,
         };
     }
 }
Exemplo n.º 19
0
 public ParticleCinder(SceneGame world, SpriteReference sprite, Vector2 pos, Vector2 velocity, float driftSpeed, float velocityMax, float rotation, float scale, LerpHelper.Delegate scaleLerp, LerpHelper.Delegate angleLerp, int time) : base(world, time)
 {
     Sprite       = sprite;
     Position     = pos;
     Velocity     = velocity;
     VelocityMax  = velocityMax;
     Rotation     = rotation;
     Angle        = Random.NextFloat() * MathHelper.TwoPi;
     Scale        = scale;
     DriftSpeed   = driftSpeed;
     DriftAngle   = Random.NextFloat() * MathHelper.TwoPi;
     ScaleLerp    = scaleLerp;
     AngleLerp    = angleLerp;
     RandomOffset = Random.NextFloat();
 }
Exemplo n.º 20
0
        public void MoveTo(MapTile tile, LerpHelper.Delegate lerp, ISlider slider)
        {
            MapTile previousTile = Tile;

            EventBus.PushEvent(new EventMove(Curio, previousTile, tile));
            UnsetMask();
            if (tile != null)
            {
                SetMask(tile);
                if (slider == null)
                {
                    TeleportVisual(tile);
                }
                else
                {
                    MoveVisual(tile, lerp, slider);
                }
            }
            EventBus.PushEvent(new EventMove.Finish(Curio, previousTile, tile));
        }
Exemplo n.º 21
0
 public static void FieldExplosion(Field field, VisualPreset.AtPosition explosion, float chanceStart, float chanceEnd, LerpHelper.Delegate chanceLerp)
 {
     if (Random.NextDouble() < chanceLerp(chanceStart, chanceEnd, field.Frame.Slide) && field.Tiles.Any())
     {
         Tile    tile   = field.Tiles.Pick(Random);
         Vector2 offset = new Vector2(-0.5f + Random.NextFloat(), -0.5f + Random.NextFloat()) * 16;
         explosion.Activate(tile.VisualTarget + offset);
     }
 }
Exemplo n.º 22
0
 public static void FieldLightning(Field field, VisualPreset.BetweenPositions arc, float chanceStart, float chanceEnd, LerpHelper.Delegate chanceLerp)
 {
     if (Random.NextDouble() < chanceLerp(chanceStart, chanceEnd, field.Frame.Slide) && field.Tiles.Any())
     {
         Tile startTile = field.Tiles.Pick(Random);
         Tile endTile   = field.Tiles.Pick(Random);
         if (startTile != endTile)
         {
             Vector2 startOffset = new Vector2(-0.5f + Random.NextFloat(), -0.5f + Random.NextFloat()) * 16;
             Vector2 endOffset   = new Vector2(-0.5f + Random.NextFloat(), -0.5f + Random.NextFloat()) * 16;
             arc.Activate(startTile.VisualTarget + startOffset, endTile.VisualTarget + endOffset);
         }
     }
 }
Exemplo n.º 23
0
        public Vector2 AnimateJump(Vector2 offset, float height, LerpHelper.Delegate lerp)
        {
            var jumpOffset = Vector2.Lerp(new Vector2(0, 0), new Vector2(0, -height), (float)Math.Sin(Slide * MathHelper.Pi));

            return(Vector2.Lerp(Vector2.Zero, offset, (float)lerp(0, 1, Slide)) + jumpOffset);
        }
Exemplo n.º 24
0
 public Vector2 AnimateBetween(Vector2 offset, LerpHelper.Delegate lerp)
 {
     return(Vector2.Lerp(Vector2.Zero, offset, (float)lerp(0, 1, Slide)));
 }
Exemplo n.º 25
0
 public Vector2 AnimatePosition(Vector2 velocity, LerpHelper.Delegate lerp)
 {
     return(Vector2.Lerp(Vector2.Zero, velocity * Frame.EndTime, (float)lerp(0, 1, Slide)));
 }
Exemplo n.º 26
0
 public int LerpSubImage(LerpHelper.Delegate lerp)
 {
     return((int)MathHelper.Clamp(Sprite.SubImageCount * (float)lerp(0, 1, Slide), 0, Sprite.SubImageCount - 1));
 }
Exemplo n.º 27
0
 public int AnimateSubImage(float imageSpeed, LerpHelper.Delegate lerp)
 {
     return((int)lerp(0, imageSpeed * Frame.EndTime, Slide));
 }
Exemplo n.º 28
0
 public ParticleCinderAbsorb(SceneGame world, SpriteReference sprite, Vector2 pos, Vector2 velocity, Vector2 target, float driftSpeed, float velocityMax, float rotation, float scale, LerpHelper.Delegate velocityLerp, LerpHelper.Delegate scaleLerp, LerpHelper.Delegate angleLerp, int time) : base(world, sprite, pos, velocity, driftSpeed, velocityMax, rotation, scale, scaleLerp, angleLerp, time)
 {
     Target       = target;
     VelocityLerp = velocityLerp;
 }
Exemplo n.º 29
0
 public ParticleAfterImage(SceneGame world, LerpHelper.Delegate scaleLerp, LerpHelper.Delegate colorLerp, int time) : base(world, time)
 {
     ScaleLerp = scaleLerp;
     ColorLerp = colorLerp;
 }
Exemplo n.º 30
0
 public ParticleAfterImageLocked(Creature creature, LerpHelper.Delegate scaleLerp, LerpHelper.Delegate colorLerp, int time) : base(creature.World, scaleLerp, colorLerp, time)
 {
     Creature = creature;
     Render   = creature.Render;
 }