EntityType.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. #include <Reader.h>
  3. #include <ReferenceCounter.h>
  4. #include <Vec3.h>
  5. #include <Writer.h>
  6. #include "ModelInfo.h"
  7. class Entity;
  8. class Game;
  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. Framework::Text name;
  19. int id;
  20. ModelInfo *model;
  21. protected:
  22. EntityType(Framework::Text name, ModelInfo* model);
  23. ~EntityType();
  24. virtual void loadSuperEntity(
  25. Entity* zEntity, Framework::StreamReader* zReader) const;
  26. virtual void saveSuperEntity(
  27. Entity* zEntity, Framework::StreamWriter* zWriter) const;
  28. virtual void createSuperEntity(Entity* zEntity) const;
  29. public:
  30. virtual bool initialize(Game *zGame);
  31. virtual Entity* loadEntity(Framework::StreamReader* zReader) const;
  32. virtual void saveEntity(
  33. Entity* zEntity, Framework::StreamWriter* zWriter) const;
  34. virtual Entity* createEntityAt(
  35. Framework::Vec3<float> position, int dimensionId) const;
  36. virtual Entity* createEntity(Framework::Vec3<float> position,
  37. int dimensionId,
  38. int entityId) const = 0;
  39. int getId() const;
  40. ModelInfo* zModel() const;
  41. void setTypeId(int id);
  42. Framework::Text getName() const;
  43. };