This repository has been archived by the owner on Jan 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCheatMode.cpp
48 lines (40 loc) · 1.68 KB
/
CheatMode.cpp
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
#include "CheatMode.hpp"
#include "../API/Engine/WindowAPI.hpp"
#include "./Components/HealthComponent.hpp"
#include "./Components/Wallet/WalletComponent.hpp"
#include "./Scenes/PoolLevel.hpp"
void CheatMode::render(const Input &i) {
_windowApi.renderCheatMenu(_isCheatMode);
if (_windowApi.showCheckBox("God Mode", &_isGodMode)) {
_characterHealthComponent->isGodMode = !_characterHealthComponent->isGodMode;
}
if (_windowApi.showCheckBox("Spawn Zombies (Middle Mouse)", &_spawnZombies)) {
_poolLevel.spawnPoolOnMiddleClick = _spawnZombies ? &_zombiePool : nullptr;
}
if (_windowApi.showCheckBox("Teleport Player (Middle Mouse)", &_teleportPlayer)) {
_character.cheatMode = _teleportPlayer;
}
if (_windowApi.showInputInt("Set Money Player", &_newValue)) {
_walletComponent->setZombytes(_newValue);
}
_windowApi.showInputText("", _newLevelValue, 100);
if (_windowApi.button("Load Level")) {
try {
ResourceManager::getInstance()->loadResource(std::string(_newLevelValue));
}
catch (std::exception &e) {
std::cout << e.what() << std::endl;
}
}
_windowApi.clearCheatMenu();
}
CheatMode::CheatMode(WindowAPI &windowApi, bool *isCheatMode)
: _windowApi(windowApi),
_isCheatMode(*isCheatMode),
_poolLevel(*Game::getInstance()->getPoolLevel()),
_zombiePool(_poolLevel.getPool("zombie")),
_character(*Game::getInstance()->getCharacter()) {
_characterHealthComponent = _character.getComponent<HealthComponent>();
_walletComponent = _character.getComponent<WalletComponent>();
_newValue = _walletComponent->getZombytes();
}