Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
spawner.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <glm/glm.hpp>
7#include <vector>
8#include <unordered_map>
9
10class ServerGameState;
11class Item;
12
19class Spawner {
20public:
22
24
25 Spawner();
26
27 /*
28 * General spawn method to manage number of enemies
29 */
30 void spawn(ServerGameState& state);
31
32 /*
33 * Selects and spawns the enemy with amount of value remaining
34 */
35 void spawnEnemy(ServerGameState& state, int valueRemaining);
36
37 /*
38 * Decreases the enemy value when enemies are killed/dead
39 */
41
42 /*
43 * Method to manually add enemies for tracking if not spawned by spawner
44 * e.g slime creating its own clone
45 */
46 void addEnemy(ServerGameState& state, SpecificID id);
47
48 /*
49 * Find empty positions that enemies can safely spawn
50 */
51 glm::vec3 findEmptyPosition(ServerGameState& state);
52
53 /*
54 * General spawn method to manage number of enemies
55 */
56 void spawnDummy(ServerGameState& state);
57
58
59 /*
60 * Smaller dummy for empty check
61 */
63
64
65private:
66 int enemyValueCap;
67 int currentEnemyValue;
68 std::vector<int> valueMap;
69 std::unordered_map<SpecificID, int> enemiesAlive;
70};
Definition: item.hpp:20
The ServerGameState class contains all abstract game state data and logic for a single game state ins...
Definition: servergamestate.hpp:43
Definition: spawner.hpp:19
void spawn(ServerGameState &state)
Definition: spawner.cpp:29
void spawnEnemy(ServerGameState &state, int valueRemaining)
Definition: spawner.cpp:49
Item * smallDummyItem
Definition: spawner.hpp:23
Spawner()
Definition: spawner.cpp:15
void addEnemy(ServerGameState &state, SpecificID id)
Definition: spawner.cpp:166
void spawnDummy(ServerGameState &state)
Definition: spawner.cpp:146
void spawnSmallDummy(ServerGameState &state)
Definition: spawner.cpp:156
void decreaseValue(SpecificID id)
Definition: spawner.cpp:193
Item * dummyItem
Definition: spawner.hpp:21
glm::vec3 findEmptyPosition(ServerGameState &state)
Definition: spawner.cpp:108
uint32_t SpecificID
Object ID within an object type-specific SmartVector (used by ServerGameState's ObjectManager)
Definition: typedefs.hpp:16