summaryrefslogtreecommitdiff
path: root/battles/src/RandomSpawner.h
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-11-11 17:02:58 +0100
committerAki <please@ignore.pl>2022-11-11 17:02:58 +0100
commitbd8b0a9ba1bdd68b915fed75f1e901851b340efd (patch)
tree03e073ed0e4ffa5063768f79821745ffd7fd45e4 /battles/src/RandomSpawner.h
parent07049889c4b1afc2306ee609dc3b0ff69a92e3f4 (diff)
downloadkurator-bd8b0a9ba1bdd68b915fed75f1e901851b340efd.zip
kurator-bd8b0a9ba1bdd68b915fed75f1e901851b340efd.tar.gz
kurator-bd8b0a9ba1bdd68b915fed75f1e901851b340efd.tar.bz2
Extracted random spawning mechanism to a dedicated class
Diffstat (limited to 'battles/src/RandomSpawner.h')
-rw-r--r--battles/src/RandomSpawner.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/battles/src/RandomSpawner.h b/battles/src/RandomSpawner.h
new file mode 100644
index 0000000..7505ae8
--- /dev/null
+++ b/battles/src/RandomSpawner.h
@@ -0,0 +1,28 @@
+#pragma once
+
+#include <random>
+
+#include <kurator/battles/components.h>
+
+
+namespace kurator
+{
+namespace battles
+{
+
+
+class RandomSpawner
+{
+public:
+ RandomSpawner(int total_teams, double distance, double variation);
+ Transform get(int team);
+private:
+ const double angle_step;
+ std::random_device device;
+ std::uniform_real_distribution<double> distribution_d;
+ std::uniform_real_distribution<double> distribution_a;
+};
+
+
+} // namespace battles
+} // namespace kurator