public void Draw(SpriteBatch sb, SpriteFont sf, Color color) { for (int index = 0; index < scoreObjs.Count; index++) { GRPlusScoreObj cScore = (GRPlusScoreObj)scoreObjs[index]; cScore.textcolor = color * cScore.opacity; sb.DrawString(sf, cScore.plusscorestring, new Vector2(cScore.position.X + 25, cScore.position.Y - 40), cScore.textcolor); } }
public void Update(GameTime gTime, GRPlayer player) { for (int index = 0; index < scoreObjs.Count; index++) { GRPlusScoreObj cScore = (GRPlusScoreObj)scoreObjs[index]; cScore.offset.Y += (float)gTime.ElapsedGameTime.TotalSeconds * GRPlusScoreObj.offsetacc; cScore.position += cScore.offset; //fade score out over time (currently lerp) cScore.opacity = 1.0f - ((GRPlusScoreObj.startingTTL - cScore.TTL) / GRPlusScoreObj.startingTTL); //remove if dead cScore.TTL -= (float)gTime.ElapsedGameTime.TotalSeconds; if (cScore.TTL <= 0) { scoreObjs.RemoveAt(index); index--; } } }