EntityType.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include <Reader.h>
  3. #include <ReferenceCounter.h>
  4. #include <Vec3.h>
  5. #include <Writer.h>
  6. #include "ModelInfo.h"
  7. #include "StaticRegistry.h"
  8. class Entity;
  9. class EntityTypeEnum
  10. {
  11. public:
  12. static const int PLAYER = 0;
  13. static const int ITEM = 1;
  14. };
  15. class EntityType : public virtual Framework::ReferenceCounter
  16. {
  17. private:
  18. const int id;
  19. const ModelInfo model;
  20. protected:
  21. EntityType(int id, ModelInfo model);
  22. virtual void loadSuperEntity(
  23. Entity* zEntity, Framework::StreamReader* zReader) const;
  24. virtual void saveSuperEntity(
  25. Entity* zEntity, Framework::StreamWriter* zWriter) const;
  26. virtual void createSuperEntity(Entity* zEntity) const;
  27. public:
  28. virtual Entity* loadEntity(Framework::StreamReader* zReader) const;
  29. virtual void saveEntity(
  30. Entity* zEntity, Framework::StreamWriter* zWriter) const;
  31. virtual Entity* createEntityAt(
  32. Framework::Vec3<float> position, int dimensionId) const;
  33. virtual Entity* createEntity(Framework::Vec3<float> position,
  34. int dimensionId,
  35. int entityId) const = 0;
  36. int getId() const;
  37. const ModelInfo& getModel() const;
  38. };