SpectatorCamera shows capturepoint HUD and respawntimer. It no longer requires CapturePointGameMode component to work.

This commit is contained in:
William Moberg
2016-03-02 13:45:49 +01:00
parent 5a8261453e
commit 629ebb871f
6 changed files with 420 additions and 34 deletions
+18
View File
@@ -1,6 +1,7 @@
#include "Core/World.h"
#include "Core/EEntityDeleted.h"
#include "Core/EComponentDeleted.h"
#include "Core/EntityWrapper.h"
World::~World()
{
@@ -151,6 +152,23 @@ std::string World::GetName(EntityID entity) const
}
}
EntityWrapper World::GetFirstEntityByName(const std::string& name)
{
auto itPair = GetDirectChildren(EntityID_Invalid);
for (auto it = itPair.first; it != itPair.second; it++) {
EntityID childEntityID = it->second;
EntityWrapper childEntity(this, childEntityID);
if (!childEntity.Valid()) {
continue;
}
EntityWrapper entityWithName = childEntity.Name() == name ? childEntity : childEntity.FirstChildByName(name);
if (entityWithName.Valid()) {
return entityWithName;
}
}
return EntityWrapper::Invalid;
}
EntityID World::generateEntityID()
{
// TODO: Make EntityID generation smarter