Entity.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #include "Entity.h"
  2. Entity::Entity( const EntityType *zType, Framework::Vec3<float> location, int dimensionId, int entityId )
  3. : Inventory( location, true ),
  4. speed( 0, 0, 0 ),
  5. faceDir( 1, 0 ),
  6. zEntityType( zType ),
  7. currentDimensionId( dimensionId ),
  8. removed( 0 ),
  9. id( entityId )
  10. {}
  11. void Entity::onDeath()
  12. {}
  13. void Entity::tick( const Dimension *zDimension, Game *zGame )
  14. {
  15. // TODO
  16. }
  17. void Entity::api( Framework::StreamReader *zRequest, NetworkResponse *zResponse )
  18. {
  19. // TODO: answer api requests
  20. }
  21. void Entity::setPosition( Framework::Vec3<float> pos )
  22. {
  23. location = pos;
  24. }
  25. float Entity::getMaxHP() const
  26. {
  27. return maxHP;
  28. }
  29. float Entity::getCurrentHP() const
  30. {
  31. return currentHP;
  32. }
  33. float Entity::getStamina() const
  34. {
  35. return stamina;
  36. }
  37. float Entity::getMaxStamina() const
  38. {
  39. return maxStamina;
  40. }
  41. float Entity::getHunger() const
  42. {
  43. return hunger;
  44. }
  45. float Entity::getMaxHunger() const
  46. {
  47. return maxHunger;
  48. }
  49. float Entity::getThirst() const
  50. {
  51. return thirst;
  52. }
  53. float Entity::getMaxThirst() const
  54. {
  55. return maxThirst;
  56. }
  57. Framework::Vec3<float> Entity::getSpeed() const
  58. {
  59. return speed;
  60. }
  61. Framework::Vec2<float> Entity::getFaceDir() const
  62. {
  63. return faceDir;
  64. }
  65. Framework::Vec3<float> Entity::getPosition() const
  66. {
  67. return location;
  68. }
  69. int Entity::getCurrentDimensionId() const
  70. {
  71. return currentDimensionId;
  72. }
  73. bool Entity::isRemoved() const
  74. {
  75. return removed;
  76. }
  77. const EntityType *Entity::zType() const
  78. {
  79. return zEntityType;
  80. }
  81. int Entity::getId() const
  82. {
  83. return id;
  84. }