Platform.cs 755 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.Xna.Framework;
  7. using Microsoft.Xna.Framework.Graphics;
  8. using Tutorial030.Interfaces;
  9. namespace Tutorial030.Sprites
  10. {
  11. public enum PlatformTypes
  12. {
  13. Dangerous,
  14. Safe,
  15. }
  16. public class Platform : Sprite, IMoveable
  17. {
  18. public Vector2 Velocity { get; set; }
  19. public PlatformTypes PlatformType;
  20. public Platform(Texture2D texture)
  21. : base(texture)
  22. {
  23. PlatformType = PlatformTypes.Safe;
  24. }
  25. public override void Update(GameTime gameTime)
  26. {
  27. Position += Velocity;
  28. if (Rectangle.Right < 0)
  29. IsRemoved = true;
  30. }
  31. }
  32. }