Esempio n. 1
0
        public override void Update(GameTime gameTime)
        {
            if (yLerp == null)
            {
                baseY = Pos.Y;
                yLerp = new Lerp();
                yLerp.Add(baseY, baseY + 4, 0.5f, Lerp.Sine);
                yLerp.Add(baseY + 4, baseY, 0.5f, Lerp.Cos);
                yLerp.Add(baseY, baseY - 4, 0.5f, Lerp.Sine);
                yLerp.Add(baseY - 4, baseY, 0.5f, Lerp.Cos, true);
            }
            Pos = new Vector2(Pos.X, yLerp.Update(gameTime));

            //TEMP Particle source
            if (world.rand.NextDouble() < 0.2)
            {
                world.AddParticle(new Particle(
                                      Images.GetImage("particle1"),
                                      Pos + new Vector2(SpriteSheet.SpriteWidth / 2, SpriteSheet.SpriteHeight / 2) + new Vector2(((float)((world.rand.NextDouble() - 0.5) * 2.0)) * SpriteSheet.SpriteWidth / 2, ((float)((world.rand.NextDouble() - 0.5) * 2.0)) * SpriteSheet.SpriteHeight / 2),
                                      new Vector2((float)((world.rand.NextDouble() - 0.5) * 10.0), (float)((world.rand.NextDouble() - 0.5) * 10.0)),
                                      0.0f,
                                      (float)((world.rand.NextDouble() - 0.5) * 4.0 * Math.PI),
                                      (float)(world.rand.NextDouble() * 0.5),
                                      new Color(Color.SandyBrown.ToVector3() + new Vector3((float)((world.rand.NextDouble() - 0.5) * 0.2), (float)((world.rand.NextDouble() - 0.5) * 0.2), (float)((world.rand.NextDouble() - 0.5) * 0.2))),
                                      (float)(world.rand.NextDouble())));
            }
        }
Esempio n. 2
0
 public LerpNode(Lerp parent, float startVal, float endVal, long duration, Lerp.LFunc lFunc, LerpNode nextLerp = null, Lerp.Callback callback = null)
 {
     this.startVal = startVal;
     this.endVal   = endVal;
     this.duration = duration;
     isFirstUpdate = true;
     this.lFunc    = lFunc;
     this.nextLerp = nextLerp;
     this.parent   = parent;
     this.callback = callback;
 }
Esempio n. 3
0
 public LocationText(string text)
 {
     Alive  = true;
     Text   = text;
     Offset = new Vector2(Consts.GameWidth / 2, Consts.GameHeight / 3);
     baseY  = Offset.Y;
     yLerp  = new Lerp();
     yLerp.Add(baseY, baseY + riseAmount, 2.0f, Lerp.Linear);
     colourRLerp = new Lerp();
     colourRLerp.Add(1.0f, 0.5f, 3.0f, Lerp.Linear);
     colourGLerp = new Lerp();
     colourGLerp.Add(1.0f, 0.5f, 3.0f, Lerp.Linear);
     colourBLerp = new Lerp();
     colourBLerp.Add(1.0f, 0.5f, 3.0f, Lerp.Linear);
 }
Esempio n. 4
0
        public void Update(GameTime gameTime)
        {
            if (colourALerp != null && colourALerp.IsDone)
            {
                Alive = false;
            }
            if (colourALerp == null && colourRLerp.IsDone)
            {
                colourALerp = new Lerp();
                colourALerp.Add(1.0f, 0.0f, 0.5f, Lerp.Sine);
            }
            Offset = new Vector2(Offset.X, yLerp.Update(gameTime));
            var r = colourRLerp.Update(gameTime);
            var g = colourGLerp.Update(gameTime);
            var b = colourBLerp.Update(gameTime);
            var a = colourALerp == null ? 1.0f : colourALerp.Update(gameTime);

            Colour = new Color(r, g, b, a);
        }