Block.cpp 477 B

1234567891011121314151617
  1. #include "common/Block.h"
  2. #include "utils/Array.h"
  3. #include "utils/ArrayList.h"
  4. static Array<ArrayList<CollisionBox, 1>, Block::MAX> collisionBoxes;
  5. void Block::init() {
  6. for(int i = 1; i < collisionBoxes.getLength(); i++) {
  7. collisionBoxes[i].add(Vector3(1.0f, 1.0f, 1.0f));
  8. }
  9. }
  10. void Block::addBoxes(Id block, List<CollisionBox>& list, const Vector3& pos) {
  11. for(const CollisionBox& box : collisionBoxes[block]) {
  12. list.add(box.offset(pos));
  13. }
  14. }