Skip to content

Commit

Permalink
make overdesign
Browse files Browse the repository at this point in the history
  • Loading branch information
onon1101 committed May 1, 2024
1 parent c0059c5 commit e06f3df
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 9 deletions.
8 changes: 7 additions & 1 deletion include/Game/Systems/HEIS.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@
* @note handle-enemy-interactive-system
*/
#include "Dungeon/Map.h"
#include "Player.h"

namespace Game::Systems {
class HEIS {
class HEIS final {
public:
static auto Init(Dungeon::Map* dungeon) -> void;

static auto DetectHealth(std::size_t mi) -> void;

private:
static Dungeon::Map* m_Map;

public:
static auto MakeTile(std::string weaponType) -> void {
LOG_INFO(weaponType);
};
};
} // namespace Game::Systems

Expand Down
2 changes: 2 additions & 0 deletions include/Game/Systems/HPIS.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
*
*/
namespace Game::Systems {
class ISC;

class HPIS final {
public:
// explicit HPIS(Player* player);
Expand Down
33 changes: 33 additions & 0 deletions include/Game/Systems/ISC.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// Created by adven on 2024/5/2.
//

#ifndef FUCK_PTSD_ISC_H
#define FUCK_PTSD_ISC_H

#include "HEIS.h"
#include "HPIS.h"
#include "Signal.h"

#include <iostream>

namespace Game::Systems {
/**
* @note internal-system-communication
*/
class ISC final {
public:
template <class... Args>
static void Handle(Systems::Signal signal, Args&&... args) {
switch (signal) {
case Systems::Signal::ADD_DROP_WEAPON:
HEIS::MakeTile(std::forward<Args>(args)...);
break;
}
};

private:
};
} // namespace Game::Systems

#endif // FUCK_PTSD_ISC_H
4 changes: 1 addition & 3 deletions include/Game/Systems/Signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
#define FUCK_PTSD_SIGNAL_H

namespace Game::Systems {
enum class Signal {

};
enum class Signal { ADD_DROP_WEAPON = 0 };
}

#endif // FUCK_PTSD_SIGNAL_H
13 changes: 8 additions & 5 deletions src/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "Music/Tempo.h"
#include "System.h"
#include "Systems/HEIS.h"
#include "Systems/HPIS.h"

using namespace tinyxml2;

Expand Down Expand Up @@ -121,12 +122,14 @@ void App::Update() {
Display::BeatHeart::SwitchHeart(100);
}


if (Util::Input::IsKeyDown(Util::Keycode::T)) {
const auto& m = m_MainCharacter->GetGamePosition();
const auto&& b = Settings::Helper::GamePosToMapIdx(m + glm::vec2{1, 0});
if (m_DungeonMap->GetMapData()->IsHasEntity(b)) {
LOG_INFO(m_DungeonMap->GetMapData()->GetEnemy(b)->GetHealth());
}
Game::Systems::HPIS::ThrowOut(Player::Direction::NONE);
// const auto& m = m_MainCharacter->GetGamePosition();
// const auto&& b = Settings::Helper::GamePosToMapIdx(m + glm::vec2{1, 0});
// if (m_DungeonMap->GetMapData()->IsHasEntity(b)) {
// LOG_INFO(m_DungeonMap->GetMapData()->GetEnemy(b)->GetHealth());
// }
}

if (Util::Input::IsKeyDown(Util::Keycode::N)) {
Expand Down
6 changes: 6 additions & 0 deletions src/Game/Systems/HPIS.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "HPIS.h"
#include "ISC.h"
#include "Player.h"
#include "Signal.h"

// Game::Systems::HPIS::HPIS(Player* player)
// : m_Players(player) {}
Expand All @@ -26,4 +28,8 @@ void Game::Systems::HPIS::IsExistWeaponThrow() {
m_Players->GetToolMod()->AddTool(_throw);
}

void Game::Systems::HPIS::ThrowOut(const Player::Direction direction) {
ISC::Handle(Signal::ADD_DROP_WEAPON, "atds");
}

Player* Game::Systems::HPIS::m_Players = nullptr;

0 comments on commit e06f3df

Please sign in to comment.