Add GameSession::GetLocalPlayerEntity
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <Client/Scene.hpp>
|
||||
#include <J3ML/LinearAlgebra.hpp>
|
||||
#include <Core/Entity.hpp>
|
||||
#include <Core/Player.hpp>
|
||||
#include <Core/World.hpp>
|
||||
#include "LocalWorld.hpp"
|
||||
#include "Hotbar.hpp"
|
||||
@@ -91,6 +92,8 @@ namespace CaveGame::Client {
|
||||
void WorldEditToolControlsUpdate(float elapsed);
|
||||
void ToggleWorldEdit();
|
||||
TileTool* WorldEditToolWindow() const { return tile_tool;}
|
||||
|
||||
Core::Player* GetLocalPlayerEntity();
|
||||
protected:
|
||||
TileTool* tile_tool = nullptr;
|
||||
LocalWorld* world = nullptr;
|
||||
|
@@ -297,4 +297,14 @@ void CaveGame::Client::GameSession::ToggleWorldEdit() {
|
||||
tile_tool->Enable(!tile_tool->IsEnabled());
|
||||
}
|
||||
|
||||
CaveGame::Core::Player *CaveGame::Client::GameSession::GetLocalPlayerEntity() {
|
||||
for (auto* e : world->GetEntities()) {
|
||||
auto maybe_plr = dynamic_cast<Core::Player *>(e);
|
||||
if (maybe_plr != nullptr) {
|
||||
return maybe_plr;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user