2023-07-03 01:16:44 +02:00
|
|
|
#ifndef HOLESOME_COLLECTABLE_SIM_GROUND_HPP
|
|
|
|
#define HOLESOME_COLLECTABLE_SIM_GROUND_HPP
|
|
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <memory>
|
|
|
|
#include "collectable_sim_ground_segment.hpp"
|
2023-07-05 01:06:57 +02:00
|
|
|
#include "../layouts/depth_hole_layout.hpp"
|
2023-07-03 01:16:44 +02:00
|
|
|
|
|
|
|
class CollectableSimGround
|
|
|
|
{
|
|
|
|
public:
|
2023-07-05 01:06:57 +02:00
|
|
|
explicit CollectableSimGround(std::shared_ptr<b2World> world, float groundWidth = 1000);
|
2023-07-03 01:16:44 +02:00
|
|
|
|
|
|
|
|
|
|
|
void setGroundWidth(float width);
|
|
|
|
|
2023-07-05 01:06:57 +02:00
|
|
|
void createLayout(DepthHoleLayout &layout);
|
|
|
|
|
2023-07-03 01:16:44 +02:00
|
|
|
private:
|
|
|
|
std::vector<std::shared_ptr<CollectableSimGroundSegment>> segments;
|
|
|
|
std::shared_ptr<b2World> world;
|
2023-07-06 01:16:47 +02:00
|
|
|
std::vector<DepthHoleDescription> currentLayoutHoles;
|
2023-07-03 01:16:44 +02:00
|
|
|
float groundWidth;
|
|
|
|
|
|
|
|
struct SideSegments {
|
|
|
|
std::shared_ptr<CollectableSimGroundSegment> left;
|
|
|
|
std::shared_ptr<CollectableSimGroundSegment> right;
|
|
|
|
};
|
|
|
|
|
2023-07-06 01:16:47 +02:00
|
|
|
CollectableSimGround::SideSegments getOuterSegments();
|
2023-07-03 01:16:44 +02:00
|
|
|
|
|
|
|
void updateOuterSegmentsToWidth();
|
2023-07-05 01:06:57 +02:00
|
|
|
|
2023-07-06 01:16:47 +02:00
|
|
|
std::shared_ptr<CollectableSimGroundSegment> createSegment(float leftCorner, float rightCorner, std::shared_ptr<CollectableSimGroundSegment> segment = nullptr);
|
2023-07-05 01:06:57 +02:00
|
|
|
|
|
|
|
void closeAllHoles();
|
2023-07-06 01:16:47 +02:00
|
|
|
|
|
|
|
bool hasLayoutChanged(DepthHoleLayout &layout);
|
2023-07-03 01:16:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //HOLESOME_COLLECTABLE_SIM_GROUND_HPP
|