World.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #pragma once
  2. #include <Welt3D.h>
  3. #include <Bildschirm.h>
  4. #include <Kam3D.h>
  5. #include <Thread.h>
  6. #include "Dimension.h"
  7. #include "PlayerKam.h"
  8. #include "FactoryClient.h"
  9. class World : public Framework::Thread
  10. {
  11. public:
  12. static World* INSTANCE;
  13. private:
  14. Dimension* currentDimension;
  15. Framework::Welt3D* renderedWorld;
  16. Framework::Bildschirm3D* zScreenPtr;
  17. PlayerKam* kam;
  18. bool firstMessage;
  19. int ownEntityId;
  20. Framework::Model3D* currentTarget;
  21. Array<Punkt> subscriptions;
  22. FactoryClient* client;
  23. Critical subLock;
  24. Critical targetLock;
  25. public:
  26. World(Framework::Bildschirm3D* zScreen, FactoryClient* client);
  27. ~World();
  28. void update(bool background);
  29. void setChunk(Chunk* chunk);
  30. void thread() override;
  31. Block* zBlockAt(Framework::Vec3<int> location) const;
  32. Block* getBlockAt(Framework::Vec3<int> location) const;
  33. Dimension* zDimension() const;
  34. void setVisibility(Chunk* zChunk, bool visible);
  35. void setVisibility(Entity* zEntity, bool visible);
  36. Framework::Punkt getChunkCenter(int x, int y) const;
  37. Entity* zEntity(int id) const;
  38. Entity* getEntity(int id) const;
  39. void removeEntity(int id);
  40. PlayerKam* zKamera() const;
  41. int getCurrentPlayerId() const;
  42. Entity* getCurrentPlayerEntity() const;
  43. void setTarget(Framework::Model3D* zTarget);
  44. void lockWorld();
  45. void unlockWorld();
  46. void onChunkAdded(Punkt pos);
  47. Chunk* zChunk(Punkt center);
  48. Framework::Model3D* getCurrentTarget() const;
  49. FactoryClient* zClient() const;
  50. };