enemy_system.hpp 1.23 KB
Newer Older
1 2 3
#pragma once

#include <mirrage/ecs/entity_manager.hpp>
4
#include <mirrage/utils/units.hpp>
5

6 7
#include "bullet_comp.hpp"
#include "continuous_path_comp.hpp"
8
#include "fixed_path_comp.hpp"
9
#include "follow_target_comp.hpp"
10
#include "shooting_comp.hpp"
11
#include "target_comp.hpp"
12 13

#include "beat_system.hpp"
14

Tim Scheiber's avatar
Tim Scheiber committed
15 16
#include "../messages.hpp"

17
namespace phase_shifter::gameplay {
18

Tim Scheiber's avatar
Tim Scheiber committed
19 20 21 22 23 24
	struct Stadium {
		glm::vec2 point1;
		glm::vec2 point2;
		float     radius;
	};

25 26
	class Enemy_system {
	  public:
27 28 29
		Enemy_system(mirrage::util::Message_bus&   bus,
		             mirrage::ecs::Entity_manager& entity_manager,
		             const Beat_system&            beat_system);
30 31 32
		void update(mirrage::util::Time dt);

	  private:
33
		mirrage::util::Message_bus&   _bus;
34
		mirrage::ecs::Entity_manager& _entity_manager;
35 36
		const Beat_system&            _beat_system;

37 38 39 40 41 42
		void do_movement(Beat_state& beat);
		void do_fixed_path_movement(Beat_state& beat);
		void do_cont_path_movement(Beat_state& beat);
		void do_hunting_movement(Beat_state& beat);
		void do_shooting(Beat_state& beat);
		void do_bullet_hit_detection();
Tim Scheiber's avatar
Tim Scheiber committed
43

44 45
		bool  intersect(const Stadium& stad1, const Stadium& stad2);
		float dot(const glm::vec2& a, const glm::vec2& b);
46
	};
47
} // namespace phase_shifter::gameplay