summaryrefslogtreecommitdiff
path: root/sim/src/BaseSimulation.cpp
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-02-14 00:13:02 +0100
committerAki <please@ignore.pl>2023-02-14 00:28:48 +0100
commit632c367ae6885657e6c99b96b8bf7a96b61a2bb9 (patch)
tree3b6210086d2c082533288d06f2843b9150e747dd /sim/src/BaseSimulation.cpp
parent2a9f378c66b28cef1c5ee063cf4d7e4e2889076e (diff)
downloadkurator-632c367ae6885657e6c99b96b8bf7a96b61a2bb9.zip
kurator-632c367ae6885657e6c99b96b8bf7a96b61a2bb9.tar.gz
kurator-632c367ae6885657e6c99b96b8bf7a96b61a2bb9.tar.bz2
Extracted basic simulation behaviour and that part of state to own class
Diffstat (limited to 'sim/src/BaseSimulation.cpp')
-rw-r--r--sim/src/BaseSimulation.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/sim/src/BaseSimulation.cpp b/sim/src/BaseSimulation.cpp
new file mode 100644
index 0000000..05b224d
--- /dev/null
+++ b/sim/src/BaseSimulation.cpp
@@ -0,0 +1,37 @@
+#include "BaseSimulation.h"
+
+#include <kurator/engine/Context.h>
+#include <kurator/sim/State.h>
+#include <kurator/sim/FloatingMovement.h>
+#include <kurator/sim/TurretControl.h>
+
+#include "systems.h"
+#include "TeamManager.h"
+
+
+namespace kurator
+{
+namespace sim
+{
+
+
+BaseSimulation::BaseSimulation(State& ctx)
+{
+ manager.extend(ctx.registry);
+}
+
+
+void
+BaseSimulation::operator()(engine::Context& ctx)
+{
+ pick_random_targets(ctx, manager);
+ keep_at_range(ctx);
+ FloatingMovement::update(ctx);
+ TurretControl::update(ctx);
+ kill_off_dead(ctx);
+ manager.update(ctx);
+}
+
+
+} // namespace sim
+} // namespace kurator