Entity.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #pragma once
  2. #include <ReferenceCounter.h>
  3. #include <Vec3.h>
  4. #include <Vec2.h>
  5. #include "Effect.h"
  6. #include "Inventory.h"
  7. #include "NetworkResponse.h"
  8. class EntityType;
  9. class Dimension;
  10. class Game;
  11. class Entity : public Inventory
  12. {
  13. protected:
  14. float maxHP;
  15. float currentHP;
  16. float stamina;
  17. float maxStamina;
  18. float hunger;
  19. float maxHunger;
  20. float thirst;
  21. float maxThirst;
  22. Framework::Vec3<float> speed;
  23. Framework::Vec2<float> faceDir;
  24. const EntityType *zEntityType;
  25. int currentDimensionId;
  26. bool removed;
  27. int id;
  28. virtual void onDeath();
  29. Entity( const EntityType *zType, Framework::Vec3<float> location, int dimensionId, int entityId );
  30. public:
  31. virtual void tick( const Dimension *zDimension, Game *zGame );
  32. virtual void api( Framework::StreamReader *zRequest, NetworkResponse *zResponse );
  33. void setPosition( Framework::Vec3<float> pos );
  34. float getMaxHP() const;
  35. float getCurrentHP() const;
  36. float getStamina() const;
  37. float getMaxStamina() const;
  38. float getHunger() const;
  39. float getMaxHunger() const;
  40. float getThirst() const;
  41. float getMaxThirst() const;
  42. Framework::Vec3<float> getSpeed() const;
  43. Framework::Vec2<float> getFaceDir() const;
  44. Framework::Vec3<float> getPosition() const;
  45. int getCurrentDimensionId() const;
  46. bool isRemoved() const;
  47. const EntityType *zType() const;
  48. int getId() const;
  49. friend Effect;
  50. friend EntityType;
  51. };