public void Update(nIDrawable Parent, nSprite[] sprites, float seconds) { var s = (Spark) Parent; var display = sprites [0]; if (!_ready) Setup(display); /* position */ s.Position [0] += s.Velocity [0] * seconds; s.Position [1] += s.Velocity [1] * seconds; s.Rotation += s.Velocity [2] * seconds; s.Scale[0] += s.ScaleChange[0] * seconds; s.Scale[1] += s.ScaleChange[1] * seconds; /* transparency */ s.Lived += seconds; Alive = s.Alive; var visibility = 0f; if (Alive) visibility = 1.0f * (s.Lifespan - s.Lived) / s.Lifespan; s.Tint[3] = visibility; /* push changes into the display */ if (display != null) { display.Color.Set(s.Tint); display.Rotation = s.Rotation; display.Position.Set(s.Position); display.Scale.Set(s.Scale); } }
public nMotion(nIDrawable parent, nIAnim motion) { Parent = parent; Motion = motion; Sprites = null; }
/** Check for participant */ public bool Contains(nIDrawable drawable) { return _drawables.Contains(drawable); }
public void Add(nIDrawable drawable) { _drawables.Add(drawable); }
public void Update(nIDrawable Parent, nSprite[] sprites, float seconds) { }
public void Update(nIDrawable Parent, nSprite[] sprites, float seconds) { _parent = (Twinkle)Parent; Life += seconds; var visible = 0.5f; var factor = 0f; if (Life < visible) factor = (Life / visible); else factor = 1.0f - (Life / (Lifespan - visible)); sprites[0].Rotation += _parent.SpinRate * seconds; sprites[0].Color[3] = factor; }
public void Update(nIDrawable Parent, nSprite[] sprites, float seconds) { _parent = (ScoreDsp) Parent; Life += seconds; var factor = 1.0f - (Life / Lifespan); sprites[0].Color[3] = factor; sprites[0].Position[1] += _parent.Float * seconds; }