BlockType.cpp 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. needModelSubscription);
  27. }
  28. int BlockType::getId() const
  29. {
  30. return id;
  31. }
  32. bool BlockType::doesNeedInstance() const
  33. {
  34. return needsInstance;
  35. }
  36. bool BlockType::doesNeedModelSubscription() const
  37. {
  38. return needModelSubscription;
  39. }
  40. const ModelInfo& BlockType::getModelInfo() const
  41. {
  42. return model;
  43. }