Skip to content
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

82-create-mobs #89

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open

82-create-mobs #89

wants to merge 28 commits into from

Conversation

Mirong1707
Copy link
Contributor

No description provided.

@Mirong1707 Mirong1707 linked an issue Apr 21, 2022 that may be closed by this pull request
8 tasks
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
Copy link
Collaborator

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>
Copy link
Collaborator

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"
Copy link
Collaborator

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) {
Copy link
Collaborator

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"
Copy link
Collaborator

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

@@ -21,7 +21,15 @@ namespace mad::core {
public:
using Id = std::int32_t;

public:
enum class Type {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не понимаю зачем нужен этот тип

namespace mad::core {

struct TagFilter : Filter {
explicit TagFilter(Entity::Type filter_tag) : Filter(Filter::Type::EntityTag), m_filter_tag(filter_tag) {
Copy link
Collaborator

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;
Copy link
Collaborator

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;
Copy link
Collaborator

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;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::string m_tag

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create Mobs
2 participants