-
Notifications
You must be signed in to change notification settings - Fork 1
/
AIGroup.h
57 lines (54 loc) · 2.51 KB
/
AIGroup.h
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
46
47
48
49
50
51
52
53
54
55
56
57
//
// File: AIGroup.h
// Author: James Beller
// Group: Hack-'n-Slash
// Date: 12/4/2015
//
#ifndef __AIGROUP_H__
#define __AIGROUP_H__
#include <allegro5\allegro.h>
#include "TerrainObjectManager.h"
#include "AI.h"
//
// This class handles 1 or more AI instances in a container.
//
class AI_Group
{
private:
//
// Private variables
//
std::map<int,AI*> group; // The container holding the group of AI instances. An ID is mapped with each AI.
bool BossActive; // Bool that tells whether the boss is active or not
int BossID; // ID of the active boss
//
// Private functions
//
bool IDExists(int); // Check the container to see if the specified ID exists
bool Overlap(AI*); // Check to see if an AI overlaps with any other AI in the group
bool OverlapWithPlayerStart(AI*); // Check to see if an AI overlaps with the player's starting position
void SetRandomSpawn(AI*); // Sets a random spawn point for an AI
ALLEGRO_BITMAP *melee_sprite; // Bitmap to be used for melee AI
ALLEGRO_BITMAP *ranger_sprite; // Bitmap to be used for ranger AI
ALLEGRO_BITMAP *boss_melee_sprite; // Bitmap to be used for boss melee AI
ALLEGRO_BITMAP *boss_ranger_sprite; // Bitmap to be used for boss ranger AI
ALLEGRO_EVENT_QUEUE *e_queue; // Pointer to event queue to use when adding AI
DungeonGenerator *dungeon; // Pointer to the dungeon the group will be in
TerrainObject_Manager drops; // Manages pickups the AI drops on death
public:
//
// Public functions
//
AI_Group(ALLEGRO_EVENT_QUEUE *);
~AI_Group() { GroupClear(); }
void EventHandler(ALLEGRO_EVENT &); // Event handler for the group
void RandomSetup(int, DungeonGenerator &); // Set up the group with random attributes
void AddRandom(); // Generate a new AI and add it to the group
void SpawnBoss(int, int); // Spawn a boss AI at specified coordinates
void GroupClear(); // Deallocate all AI and clear the container
void ProcessAll(ALLEGRO_EVENT &, Player &); // Process everyone in the group
void DrawAll(); // Draw everyone on the screen
bool CollideWithAI(int, int); // Check to see if the given bound points collide with any of the AI
void HitAI(int, int, int); // Check to see if the active weapon collides with any of the AI
};
#endif