FadingPiece.cs 600 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Microsoft.Xna.Framework;
  6. namespace Flood_Control
  7. {
  8. class FadingPiece : GamePiece
  9. {
  10. public float alphaLevel = 1.0f;
  11. public static float alphaChangeRate = 0.02f;
  12. public FadingPiece(string pieceType, string suffix)
  13. : base(pieceType, suffix)
  14. {
  15. }
  16. public void UpdatePiece()
  17. {
  18. alphaLevel = MathHelper.Max(
  19. 0,
  20. alphaLevel - alphaChangeRate);
  21. }
  22. }
  23. }