-
Notifications
You must be signed in to change notification settings - Fork 2
82-create-mobs #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
82-create-mobs #89
Conversation
core/CMakeLists.txt
Outdated
world/filter/TrueFilter.hpp | ||
world/filter/IdFilter.hpp | ||
world/entity/EntityStorage.cpp world/entity/EntityStorage.hpp | ||
world/entity/ViewableEntity.hpp world/entity/ViewableEntity.cpp | ||
world/entity/Entity.hpp world/entity/Entity.cpp | ||
world/entity/Mobs/Mob.hpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
папки называются с маленькой буквы везде
@@ -0,0 +1,14 @@ | |||
#include "Controller.hpp" | |||
#include <spdlog/spdlog.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Неправильный стиль иклюдов....
Controller
event/...
world/...
spdlog/...
utility
@@ -0,0 +1,49 @@ | |||
#include "MobController.hpp" | |||
#include "event/system/KeyPressed.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Неправильный стиль инклюдов, ещё кавычки не те
} | ||
void mad::core::MobController::control() { | ||
for (Entity::Id entity_id : m_storage->extract(TagFilter(Entity::Type::Enemy))) { | ||
if (&m_storage->get_entity(entity_id) != nullptr && cast_to_or_null<Mob>(m_storage->get_entity(entity_id)) != nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
В чём смысл этой проверки? clion вроде это должен подсвечивать. Тебе get_entity вернул какой-то объект, у него конечно адрес не nullptr
@@ -0,0 +1,49 @@ | |||
#include "MobController.hpp" | |||
#include "event/system/KeyPressed.hpp" | |||
#include "world/entity/Mobs/Mob.hpp" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MobController - это определённая стратегия, по которой ведёт себя моб. То есть это уже относится к тому, как именно игра играется. поэтому это должно быть в папке ./game. Например, ./game/mobs/MobController
core/world/entity/Entity.hpp
Outdated
@@ -21,7 +21,15 @@ namespace mad::core { | |||
public: | |||
using Id = std::int32_t; | |||
|
|||
public: | |||
enum class Type { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Не понимаю зачем нужен этот тип
core/world/filter/TagFilter.hpp
Outdated
namespace mad::core { | ||
|
||
struct TagFilter : Filter { | ||
explicit TagFilter(Entity::Type filter_tag) : Filter(Filter::Type::EntityTag), m_filter_tag(filter_tag) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тэгов ведь может быть сколь угодно много. Думаю для них лучше использовать строки, а не enum-ы. И так можно будет избавиться от Entity::Type
} | ||
|
||
private: | ||
Vec2d p; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_point
|
||
private: | ||
Vec2d p; | ||
float r; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_radius
private: | ||
Vec2d p; | ||
float r; | ||
Entity::Type m_filter_tag; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::string m_tag
No description provided.