Skip to content

82-create-mobs#89

Open
Mirong1707 wants to merge 28 commits intomainfrom
82-create-mobs
Open

82-create-mobs#89
Mirong1707 wants to merge 28 commits intomainfrom
82-create-mobs

Conversation

@Mirong1707
Copy link
Contributor

No description provided.

@Mirong1707 Mirong1707 requested a review from Glebanister April 21, 2022 16:28
@Mirong1707 Mirong1707 linked an issue Apr 21, 2022 that may be closed by this pull request
8 tasks
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

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

@Mirong1707 Mirong1707 requested a review from Glebanister April 28, 2022 09:06
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