mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-27 08:13:18 +00:00
fixing compil
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#include <Items/Bonus.hpp>
|
||||
#include <Exception/Error.hpp>
|
||||
#include "ParserYaml.hpp"
|
||||
#include "Component/Speed/SpeedComponent.hpp"
|
||||
#include <algorithm>
|
||||
#include <Component/Levitate/LevitateComponent.hpp>
|
||||
#include <Runner/Runner.hpp>
|
||||
@@ -84,17 +85,17 @@ namespace BBM {
|
||||
auto *position = entity.tryGetComponent<PositionComponent>();
|
||||
auto *bombHolder = entity.tryGetComponent<BombHolderComponent>();
|
||||
auto *model = entity.tryGetComponent<Drawable3DComponent>();
|
||||
auto *controllable = entity.tryGetComponent<ControllableComponent>();
|
||||
auto *speed = entity.tryGetComponent<SpeedComponent>();
|
||||
auto name = entity.getName();
|
||||
|
||||
if (!position || !bombHolder || !model || !controllable)
|
||||
if (!position || !bombHolder || !model || !speed)
|
||||
return;
|
||||
std::replace(name.begin(), name.end(), ' ', '_');
|
||||
_player << std::endl << " " << name << ":" << std::endl << " ";
|
||||
_player << "texture_path: " << dynamic_cast<RAY3D::Model *>(model->drawable.get())->getTextureByMaterial(MAP_DIFFUSE).getResourcePath() << std::endl << " ";
|
||||
_player << "max_bomb: " << std::to_string(bombHolder->maxBombCount) << std::endl << " ";
|
||||
_player << "explosion_radius: " << std::to_string(bombHolder->explosionRadius) << std::endl << " ";
|
||||
_player << "speed: " << std::to_string(controllable->speed) << std::endl << " ";
|
||||
_player << "speed: " << std::to_string(speed->speed) << std::endl << " ";
|
||||
_player << "position: [" << std::to_string(position->getX()) << "," << std::to_string(position->getY()) << "," << std::to_string(position->getZ()) << "]";
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "Component/BombHolder/BombHolderComponent.hpp"
|
||||
#include "Component/Tag/TagComponent.hpp"
|
||||
#include "Component/Renderer/Drawable3DComponent.hpp"
|
||||
#include "Component/Speed/SpeedComponent.hpp"
|
||||
#include "Component/Renderer/Drawable2DComponent.hpp"
|
||||
#include <Drawables/Image.hpp>
|
||||
#include "Drawables/2D/Text.hpp"
|
||||
@@ -71,6 +72,7 @@ namespace BBM
|
||||
.addComponent<BumperTimerComponent>()
|
||||
.addComponent<TagComponent<BlowablePass>>()
|
||||
.addComponent<TagComponent<Player>>()
|
||||
.addComponent<SpeedComponent>()
|
||||
.addComponent<AnimationsComponent>("assets/player/player.iqm", 3)
|
||||
.addComponent<CollisionComponent>(BBM::Vector3f{0.25, 0, 0.25}, BBM::Vector3f{.75, 2, .75})
|
||||
.addComponent<MovableComponent>()
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace BBM
|
||||
void ControllableSystem::onFixedUpdate(WAL::ViewEntity<ControllableComponent, MovableComponent> &entity)
|
||||
{
|
||||
auto &controllable = entity.get<ControllableComponent>();
|
||||
auto &speed = entity.get<SpeedComponent>();
|
||||
// todo check why the .get doesn't work
|
||||
auto &speed = entity->getComponent<SpeedComponent>();
|
||||
auto &movable = entity.get<MovableComponent>();
|
||||
auto health = entity->tryGetComponent<HealthComponent>();
|
||||
Vector2f move = controllable.move.normalized() * speed.speed;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "Component/Renderer/Drawable2DComponent.hpp"
|
||||
#include "System/Lobby/LobbySystem.hpp"
|
||||
#include "Component/Controllable/ControllableComponent.hpp"
|
||||
#include "Component/Speed/SpeedComponent.hpp"
|
||||
#include "System/MenuControllable/MenuControllableSystem.hpp"
|
||||
#include "Component/Tag/TagComponent.hpp"
|
||||
#include <algorithm>
|
||||
@@ -257,14 +258,14 @@ namespace BBM
|
||||
.addComponent<PositionComponent>(x + 220, y + 122, 0)
|
||||
.addComponent<Drawable2DComponent, RAY2D::Text>("", 20, x, y, WHITE)
|
||||
.addComponent<StatComponent>([&player](Drawable2DComponent &drawble) {
|
||||
const ControllableComponent *bonus = player.tryGetComponent<ControllableComponent>();
|
||||
auto *speed = player.tryGetComponent<SpeedComponent>();
|
||||
|
||||
if (!bonus)
|
||||
if (!speed)
|
||||
return;
|
||||
RAY2D::Text *text = dynamic_cast<RAY2D::Text *>(drawble.drawable.get());
|
||||
if (!text)
|
||||
return;
|
||||
text->setText(std::to_string(static_cast<int>(bonus->speed * 100)));
|
||||
text->setText(std::to_string(static_cast<int>(speed->speed * 100)));
|
||||
});
|
||||
scene->addEntity("player hide wall")
|
||||
.addComponent<PositionComponent>(x + 220, y + 161, 0)
|
||||
@@ -304,14 +305,14 @@ namespace BBM
|
||||
auto *position = player.tryGetComponent<PositionComponent>();
|
||||
auto *bombHolder = player.tryGetComponent<BombHolderComponent>();
|
||||
auto *model = player.tryGetComponent<Drawable3DComponent>();
|
||||
auto *controllable = player.tryGetComponent<ControllableComponent>();
|
||||
if (position && bombHolder && model && controllable) {
|
||||
auto *speed = player.tryGetComponent<SpeedComponent>();
|
||||
if (position && bombHolder && model && speed) {
|
||||
dynamic_cast<RAY3D::Model *>(model->drawable.get())->setTextureToMaterial(MAP_DIFFUSE,
|
||||
ParserYAML::playersInfos[countPlayer].asset);
|
||||
position->position = ParserYAML::playersInfos[countPlayer].position;
|
||||
bombHolder->explosionRadius = ParserYAML::playersInfos[countPlayer].explosionRange;
|
||||
bombHolder->maxBombCount = ParserYAML::playersInfos[countPlayer].maxBombCount;
|
||||
controllable->speed = ParserYAML::playersInfos[countPlayer].speed;
|
||||
speed->speed = ParserYAML::playersInfos[countPlayer].speed;
|
||||
}
|
||||
addController(player, lobby.layout);
|
||||
countPlayer++;
|
||||
|
||||
Reference in New Issue
Block a user