BlockType.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #include "BlockType.h"
  2. #include "Block.h"
  3. using namespace Framework;
  4. BlockType::BlockType(int id,
  5. bool needsInstance,
  6. ModelInfo model,
  7. int initialMaxHP,
  8. bool needModelSubscription,
  9. bool fluid,
  10. char maxFlowDistance,
  11. Direction defaultFrontDirection)
  12. : ReferenceCounter(),
  13. id(id),
  14. needsInstance(needsInstance),
  15. model(model),
  16. initialMaxHP(initialMaxHP),
  17. needModelSubscription(needModelSubscription),
  18. fluid(fluid),
  19. maxFlowDistance(maxFlowDistance),
  20. defaultFrontDirection(defaultFrontDirection)
  21. {}
  22. BlockType::~BlockType() {}
  23. Block* BlockType::createBlock(Framework::Vec3<int> position,
  24. bool passable,
  25. float speedModifier,
  26. Direction dir)
  27. {
  28. return new Block(this,
  29. position,
  30. model.getModel(),
  31. model.getTexture(),
  32. initialMaxHP,
  33. model.isTransparent(),
  34. needModelSubscription,
  35. model.getSize(),
  36. passable,
  37. speedModifier,
  38. dir);
  39. }
  40. int BlockType::getId() const
  41. {
  42. return id;
  43. }
  44. bool BlockType::doesNeedInstance() const
  45. {
  46. return needsInstance;
  47. }
  48. bool BlockType::doesNeedModelSubscription() const
  49. {
  50. return needModelSubscription;
  51. }
  52. bool BlockType::isFluid() const
  53. {
  54. return fluid;
  55. }
  56. char BlockType::getMaxFlowDistance() const
  57. {
  58. return maxFlowDistance;
  59. }
  60. Direction BlockType::getDefaultFrontDirection() const
  61. {
  62. return defaultFrontDirection;
  63. }
  64. const ModelInfo& BlockType::getModelInfo() const
  65. {
  66. return model;
  67. }