holesome/src/game/physics/holes/collectable_simulation.hpp

36 lines
900 B
C++

#ifndef HOLESOME_COLLECTABLE_SIMULATION_HPP
#define HOLESOME_COLLECTABLE_SIMULATION_HPP
#include <box2d/box2d.h>
#include <map>
#include "../../game_object.h"
#include "../../collectables/collectable.hpp"
#include "ground/collectable_sim_ground_segment.hpp"
#include "ground/collectable_sim_ground.hpp"
#include "../body_adapter.hpp"
class CollectableSimulation : public GameObject
{
public:
explicit CollectableSimulation(const std::shared_ptr<Collectable> &collectable);
void physicsUpdate() override;
[[nodiscard]] std::shared_ptr<Collectable> getCollectable() const;
private:
std::shared_ptr<b2World> world;
std::shared_ptr<BodyAdapter> collectableBody;
std::shared_ptr<Collectable> collectable;
std::shared_ptr<CollectableSimGround> simGround;
void updateGroundHole();
void updateCollectable();
};
#endif //HOLESOME_COLLECTABLE_SIMULATION_HPP