Healthbar on player

This commit is contained in:
viktorljung
2016-01-24 22:21:10 +01:00
parent 0c557317a9
commit 7e92d6f53f
4 changed files with 45 additions and 10 deletions
+32 -8
View File
@@ -2,15 +2,14 @@
<Entity name="Player" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Health/>
<c:AABB>
<Origin X="0" Y="0.772000015" Z="0"/>
<Size X="1" Y="1.60000002" Z="1"/>
</c:AABB>
<c:Collidable/>
<c:Model/>
<c:Physics>
<Velocity X="8.33307467e-09" Y="0" Z="9.82836834e-09"/>
</c:Physics>
<c:Physics/>
<c:Player>
<MovementSpeed>5</MovementSpeed>
</c:Player>
@@ -19,10 +18,7 @@
<Red/>
</Team>
</c:Team>
<c:Transform>
<Position X="2.84928203" Y="0.0264999866" Z="7.31610918"/>
<Orientation X="0" Y="2.14675093" Z="0"/>
</c:Transform>
<c:Transform/>
</Components>
<Children>
@@ -31,7 +27,6 @@
<c:Camera/>
<c:Transform>
<Position X="0" Y="1.37700009" Z="0"/>
<Orientation X="0.921535373" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -62,6 +57,34 @@
</Components>
<Children/>
</Entity>
<Entity name="HUD">
<Components>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
</c:Transform>
</Components>
<Children>
<Entity name="HealthBar">
<Components>
<c:HealthHUD/>
<c:Fill>
<Percentage>1</Percentage>
<Color A="0" B="1" G="0" R="0"/>
</c:Fill>
<c:Model>
<Resource>Models/Core/UnitHexagon.mesh</Resource>
<Color A="1" B="0.70588237" G="0.70588237" R="0.70588237"/>
</c:Model>
<c:Transform>
<Position X="-0.383000016" Y="-0.185000002" Z="0"/>
<Scale X="0.150000006" Y="0.150000006" Z="0.150000006"/>
<Orientation X="0" Y="0.594000041" Z="0"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
<Entity name="ThirdPersonCamera">
@@ -82,6 +105,7 @@
<Components>
<c:Model>
<Resource>Models/AssaultHeadless.mesh</Resource>
<Color A="1" B="0" G="0" R="1"/>
</c:Model>
<c:Transform>
<Orientation X="0" Y="3.14159274" Z="0"/>
+9
View File
@@ -1,4 +1,5 @@
#include "Editor/EditorGUI.h"
#include "Rendering/ESetCamera.h"
EditorGUI::EditorGUI(World* world, EventBroker* eventBroker)
: m_World(world)
@@ -305,6 +306,14 @@ bool EditorGUI::drawComponentNode(EntityWrapper entity, const ComponentInfo& ci)
}
}
if (ci.Name == "Camera") {
if (ImGui::Button("Activate")) {
Events::SetCamera e;
e.CameraEntity = entity;
m_EventBroker->Publish(e);
}
}
return true;
}
+1 -1
View File
@@ -203,7 +203,7 @@ bool EditorSystem::OnSetCamera(const Events::SetCamera& e)
m_ActualCamera = e.CameraEntity;
Events::SetCamera e2;
e2.CameraEntity = m_EditorCamera;
m_EventBroker->Publish(e2);
//m_EventBroker->Publish(e2);
}
return true;
}
+3 -1
View File
@@ -52,7 +52,9 @@ void RenderSystem::fillModels(std::list<std::shared_ptr<RenderJob>>& jobs)
// Don't render the local player
if (entity == m_LocalPlayer || entity.IsChildOf(m_LocalPlayer)) {
continue;
if (!entity.HasComponent("HealthHUD")) { //Should work but needs to be fixed. Should only render the things "childed" to the local player camera
continue;
}
}
Model* model;