Entity.h 1.3 KB

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