summaryrefslogtreecommitdiff
path: root/kurator/src/Battle.h
blob: f6ec8d6b2c95dc5a64cee1df5a9ea5dcb2723e65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once

#include <functional>
#include <memory>

#include <kurator/campaign/Scenario.h>
#include <kurator/sim/events.h>
#include <kurator/sim/State.h>
#include <kurator/sim/System.h>
#include <kurator/stats/EventLog.h>
#include <kurator/stats/events.h>

#include "ForceBalance.h"
#include "Scene.h"
#include "Session.h"


namespace kurator
{


class Battle : public Scene
{
public:
	using Callback = std::function<void(const stats::EventLog&)>;
	explicit Battle(std::shared_ptr<Session> _session);
	Battle(std::shared_ptr<Session> _session, campaign::Scenario scenario, Callback _report={});
	virtual ~Battle();
	void update() override;
	void draw() const override;
	void on_end(const sim::End& end);
	void on_hit(const sim::Hit& hit);
	void on_destroyed(const sim::Destroyed& event);
	void on_ship_left(const stats::ShipLeft& event);  // duplicated?
private:
	std::shared_ptr<Session> session;
	sim::State ctx;
	sim::System simulation_base;
	ForceBalance balance;
	stats::EventLog log;
	Callback report;
};


}  // namespace kurator