Entity.h 1.0 KB

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