Creepy-simulation
 
Loading...
Searching...
No Matches
Simulation.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4
5#include "Creeper.hpp"
6#include "CreepersManager.hpp"
7#include "Steve.hpp"
8#include "StevesManager.hpp"
17 std::shared_ptr<FieldParams> fieldParams_;
18 CreepersManager creepersManager_;
19 StevesManager stevesManager_;
20
21 public:
28 Simulation(const std::shared_ptr<FieldParams>& fieldParams, const std::shared_ptr<CreepersParams>& creepersParams,
29 const std::shared_ptr<StevesParams>& stevesParams);
35 void updateField();
40 CreepersManager& getCreepersManager() { return creepersManager_; }
45 StevesManager& getStevesManager() { return stevesManager_; }
51 Simulation& setBedrock(const Rectangle& bedrock) {
52 const auto upBound = fieldParams_->getBounds().rightUpBound;
53 const auto downBound = fieldParams_->getBounds().leftDownBound;
54 if (bedrock.rightUpBound.x > upBound.x || bedrock.rightUpBound.y > upBound.y ||
55 bedrock.leftDownBound.x < downBound.x || bedrock.leftDownBound.y < downBound.y) {
56 LOG(WARNING) << "Bedrock is out of field bounds!";
57 }
58 fieldParams_->setBedrock(bedrock);
59 return *this;
60 }
61
63 fieldParams_->deleteBedrock(bedrock);
64 return *this;
65 }
66};
Manages a collection of creeper entities and their interactions.
Definition CreepersManager.hpp:15
Main controller for managing the simulation of creepers and Steves.
Definition Simulation.hpp:16
Simulation & deleteBedrock(const Rectangle &bedrock)
Definition Simulation.hpp:62
CreepersManager & getCreepersManager()
Provides access to the CreepersManager.
Definition Simulation.hpp:40
Simulation & setBedrock(const Rectangle &bedrock)
Configures bedrock for the simulation field.
Definition Simulation.hpp:51
StevesManager & getStevesManager()
Provides access to the StevesManager.
Definition Simulation.hpp:45
void updateField()
Updates the simulation field.
Definition Simulation.cpp:17
Менеджер для управления сущностями типа Steve.
Definition StevesManager.hpp:16
Represents a rectangle defined by two points: bottom-left and top-right.
Definition utils.hpp:24