WorldUpdate.h 733 B

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include <ReferenceCounter.h>
  3. #include <Vec3.h>
  4. #include <Writer.h>
  5. class Dimension;
  6. class WorldUpdateTypeEnum
  7. {
  8. public:
  9. static const int ADD_ENTITY = 0;
  10. static const int REMOVE_ENTITY = 1;
  11. };
  12. class WorldUpdate : public Framework::ReferenceCounter
  13. {
  14. private:
  15. int affectedDimensionId;
  16. int type;
  17. Framework::Vec3<float> pos;
  18. protected:
  19. virtual void write(Framework::StreamWriter* zWriter) = 0;
  20. public:
  21. WorldUpdate(int type, int dimensionId, Framework::Vec3<float> pos);
  22. virtual void onUpdate(Dimension* zDimension) = 0;
  23. void writeAndCheck(Framework::StreamWriter* zWriter);
  24. int getAffectedDimension() const;
  25. int getType() const;
  26. int distanceTo(int x, int y) const;
  27. };