Entity.h 988 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #pragma once
  2. #include <Critical.h>
  3. #include <Either.h>
  4. #include <Model3D.h>
  5. #include "Area.h"
  6. #include "EntityType.h"
  7. #include "FactoryCraftModel.h"
  8. class Block;
  9. struct MovementFrame
  10. {
  11. Framework::Vec3<float> position;
  12. float rotation;
  13. float duration;
  14. };
  15. class Entity : public FactoryCraftModel
  16. {
  17. private:
  18. int id;
  19. const EntityType* zType;
  20. bool playerControlled;
  21. Framework::Critical cs;
  22. MovementFrame currentFrame;
  23. Framework::Array<MovementFrame> frames;
  24. double frameLength;
  25. public:
  26. Entity(const EntityType* zType,
  27. Framework::Model3DData* model,
  28. Framework::Model3DTextur* texture,
  29. int id,
  30. Framework::Vec3<float> position,
  31. float size);
  32. ~Entity();
  33. void api(char* message);
  34. bool tick(double time) override;
  35. int getId() const;
  36. const EntityType* zEntityType() const;
  37. void lock();
  38. void unlock();
  39. void setPlayerControlled();
  40. };