Velocity.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Artemis;
  6. namespace StarWarrior.Components
  7. {
  8. class Velocity : Component
  9. {
  10. private float velocity;
  11. private float angle;
  12. public Velocity()
  13. {
  14. }
  15. public Velocity(float vector)
  16. {
  17. this.velocity = vector;
  18. }
  19. public Velocity(float velocity, float angle)
  20. {
  21. this.velocity = velocity;
  22. this.angle = angle;
  23. }
  24. public float GetVelocity()
  25. {
  26. return velocity;
  27. }
  28. public void SetVelocity(float velocity)
  29. {
  30. this.velocity = velocity;
  31. }
  32. public void SetAngle(float angle)
  33. {
  34. this.angle = angle;
  35. }
  36. public float GetAngle()
  37. {
  38. return angle;
  39. }
  40. public void AddAngle(float a)
  41. {
  42. angle = (angle + a) % 360;
  43. }
  44. public float GetAngleAsRadians()
  45. {
  46. return (float)Math.PI * angle / 180.0f; ;
  47. }
  48. }
  49. }