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

37 lines
900 B
C++
Raw Normal View History

2023-06-28 16:57:13 +02:00
#ifndef HOLESOME_COLLECTABLE_SIMULATION_HPP
#define HOLESOME_COLLECTABLE_SIMULATION_HPP
#include <box2d/box2d.h>
#include <map>
2023-06-28 16:57:13 +02:00
#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"
2023-06-28 16:57:13 +02:00
class CollectableSimulation : public GameObject
{
public:
explicit CollectableSimulation(const std::shared_ptr<Collectable> &collectable);
void physicsUpdate() override;
[[nodiscard]] std::shared_ptr<Collectable> getCollectable() const;
2023-06-28 16:57:13 +02:00
private:
std::shared_ptr<b2World> world;
std::shared_ptr<BodyAdapter> collectableBody;
2023-06-28 16:57:13 +02:00
std::shared_ptr<Collectable> collectable;
std::shared_ptr<CollectableSimGround> simGround;
2023-06-28 16:57:13 +02:00
void updateGroundHole();
void updateCollectable();
2023-06-28 16:57:13 +02:00
};
#endif //HOLESOME_COLLECTABLE_SIMULATION_HPP