BlockType.cpp 909 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #include "BlockType.h"
  2. #include "Block.h"
  3. #include "Registries.h"
  4. using namespace Framework;
  5. BlockType::BlockType(int id,
  6. bool needsInstance,
  7. ModelInfo model,
  8. int initialMaxHP,
  9. bool needModelSubscription)
  10. : ReferenceCounter(),
  11. id(id),
  12. needsInstance(needsInstance),
  13. model(model),
  14. initialMaxHP(initialMaxHP),
  15. needModelSubscription(needModelSubscription)
  16. {}
  17. BlockType::~BlockType() {}
  18. Block* BlockType::createBlock(Framework::Vec3<int> position)
  19. {
  20. return new Block(this,
  21. position,
  22. model.getModel(),
  23. model.getTexture(),
  24. initialMaxHP,
  25. model.isTransparent());
  26. }
  27. int BlockType::getId() const
  28. {
  29. return id;
  30. }
  31. bool BlockType::doesNeedInstance() const
  32. {
  33. return needsInstance;
  34. }
  35. bool BlockType::doesNeedModelSubscription() const
  36. {
  37. return needModelSubscription;
  38. }