Fixed text color and removed debugging code
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
<Entity name="Player">
|
<Entity name="Player">
|
||||||
<Components>
|
<Components>
|
||||||
<c:Health>
|
<c:Health>
|
||||||
<Health>69.990005493164063</Health>
|
<Health>65.990005493164063</Health>
|
||||||
</c:Health>
|
</c:Health>
|
||||||
<c:Player/>
|
<c:Player/>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Assault.obj</Resource>
|
<Resource>Models/Assault.obj</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="3.92156863" R="3.92156863"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Orientation X="0" Y="3.14159203" Z="0"/>
|
<Orientation X="0" Y="3.14159203" Z="0"/>
|
||||||
@@ -53,8 +54,8 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:HealthHUD/>
|
<c:HealthHUD/>
|
||||||
<c:Fill>
|
<c:Fill>
|
||||||
<Percentage>0.69990003108978271</Percentage>
|
<Percentage>0.65990006923675537</Percentage>
|
||||||
<Color A="0" B="0.699900031" G="0" R="0.300099969"/>
|
<Color A="0" B="0.659900069" G="0" R="0.340099931"/>
|
||||||
</c:Fill>
|
</c:Fill>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitHexagon.obj</Resource>
|
<Resource>Models/Core/UnitHexagon.obj</Resource>
|
||||||
@@ -83,7 +84,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/SecondaryWeapon.fbx</Resource>
|
<Resource>Models/SecondaryWeapon.fbx</Resource>
|
||||||
<Color A="0.784313738" B="1" G="1" R="1"/>
|
<Color A="0.423529416" B="1" G="3.92156863" R="1"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.00400000019" Y="0.0138316695" Z="0.00813383237"/>
|
<Position X="-0.00400000019" Y="0.0138316695" Z="0.00813383237"/>
|
||||||
@@ -110,7 +111,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/SecondaryWeapon.fbx</Resource>
|
<Resource>Models/SecondaryWeapon.fbx</Resource>
|
||||||
<Color A="0.588235319" B="0" G="0" R="0"/>
|
<Color A="0.466666669" B="0" G="0" R="0"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.00400000019" Y="0.0136327185" Z="0.00800000038"/>
|
<Position X="-0.00400000019" Y="0.0136327185" Z="0.00800000038"/>
|
||||||
@@ -121,8 +122,68 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity name="Ammo">
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>24</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,60</Resource>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-1.43861985e-06" Y="0.0125972452" Z="0.0100018298"/>
|
||||||
|
<Scale X="0.349999994" Y="0.349999994" Z="0.200000003"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Text>
|
||||||
|
<Content>262</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,60</Resource>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-4.27209579e-06" Y="-0.0390000008" Z="5.43686883e-06"/>
|
||||||
|
<Scale X="0.65200001" Y="0.643000007" Z="1"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:HealthHUD/>
|
||||||
|
<c:Text>
|
||||||
|
<Content>65/100</Content>
|
||||||
|
<Resource>Fonts/DroidSans.ttf,60</Resource>
|
||||||
|
<Color A="1" B="0.659900069" G="0" R="0.340099931"/>
|
||||||
|
</c:Text>
|
||||||
|
<c:Transform>
|
||||||
|
<Scale X="0.200000003" Y="0.200000003" Z="0.200000003"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:HealthHUD/>
|
||||||
|
<c:Fill>
|
||||||
|
<Percentage>0.65990006923675537</Percentage>
|
||||||
|
<Color A="0" B="0.659900069" G="0" R="0.340099931"/>
|
||||||
|
</c:Fill>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitRaptor.obj</Resource>
|
||||||
|
<Color A="0.678431392" B="3.92156863" G="3.92156863" R="3.92156863"/>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="-0.118439019" Z="-0.165149197"/>
|
||||||
|
<Scale X="0.100000001" Y="1" Z="0.200000003"/>
|
||||||
|
<Orientation X="1.42800009" Y="1.61800003" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
</Entity>
|
</Entity>
|
||||||
</Children>
|
</Children>
|
||||||
@@ -145,6 +206,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Assault.obj</Resource>
|
<Resource>Models/Assault.obj</Resource>
|
||||||
|
<Color A="1" B="3.92156863" G="1" R="1"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-2.5" Y="0" Z="1"/>
|
<Position X="-2.5" Y="0" Z="1"/>
|
||||||
@@ -157,6 +219,7 @@
|
|||||||
<c:Text>
|
<c:Text>
|
||||||
<Content>Welcome!</Content>
|
<Content>Welcome!</Content>
|
||||||
<Resource>Fonts/DroidSans.ttf,1280</Resource>
|
<Resource>Fonts/DroidSans.ttf,1280</Resource>
|
||||||
|
<Color A="0" B="3.92156863" G="3.92156863" R="3.92156863"/>
|
||||||
</c:Text>
|
</c:Text>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="0.700000048"/>
|
<Position X="0" Y="0" Z="0.700000048"/>
|
||||||
@@ -167,32 +230,40 @@
|
|||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
<c:RaptorCopter>
|
<c:RaptorCopter>
|
||||||
<Speed>2</Speed>
|
<Speed>3</Speed>
|
||||||
<Axis X="0" Y="1" Z="0"/>
|
<Axis X="0.200000003" Y="3.4000001" Z="0.5"/>
|
||||||
</c:RaptorCopter>
|
</c:RaptorCopter>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="2.37320328" Z="0"/>
|
<Orientation X="676.517334" Y="19246.6816" Z="1116.82788"/>
|
||||||
<Orientation X="0" Y="14039.5469" Z="0"/>
|
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.obj</Resource>
|
||||||
|
<Color A="1" B="7.84313726" G="0" R="7.84313726"/>
|
||||||
|
</c:Model>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
<Color A="1" B="1" G="0" R="1"/>
|
<Color A="1" B="1" G="0" R="1"/>
|
||||||
<Radius>6</Radius>
|
<Radius>70</Radius>
|
||||||
<Intensity>0.5</Intensity>
|
<Intensity>0.5</Intensity>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-2.5" Y="0" Z="0"/>
|
<Position X="-2.5" Y="0" Z="0"/>
|
||||||
|
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.obj</Resource>
|
||||||
|
<Color A="1" B="0" G="0" R="7.84313726"/>
|
||||||
|
</c:Model>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
<Color A="1" B="0" G="0" R="1"/>
|
<Color A="1" B="0" G="0" R="1"/>
|
||||||
<Radius>8</Radius>
|
<Radius>70</Radius>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-5" Y="0" Z="0"/>
|
<Position X="-5" Y="0" Z="0"/>
|
||||||
@@ -204,21 +275,30 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.obj</Resource>
|
||||||
|
<Color A="1" B="0" G="7.84313726" R="7.84313726"/>
|
||||||
|
</c:Model>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
<Color A="1" B="0" G="1" R="1"/>
|
<Color A="1" B="0" G="1" R="1"/>
|
||||||
<Radius>6</Radius>
|
<Radius>70</Radius>
|
||||||
<Intensity>0.5</Intensity>
|
<Intensity>0.5</Intensity>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="-2.5"/>
|
<Position X="0" Y="0" Z="-2.5"/>
|
||||||
|
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.obj</Resource>
|
||||||
|
<Color A="1" B="0" G="7.84313726" R="0"/>
|
||||||
|
</c:Model>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
<Color A="1" B="0" G="1" R="0"/>
|
<Color A="1" B="0" G="1" R="0"/>
|
||||||
<Radius>8</Radius>
|
<Radius>70</Radius>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="-5"/>
|
<Position X="0" Y="0" Z="-5"/>
|
||||||
@@ -230,21 +310,30 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.obj</Resource>
|
||||||
|
<Color A="1" B="7.84313726" G="7.84313726" R="0"/>
|
||||||
|
</c:Model>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
<Color A="1" B="1" G="1" R="0"/>
|
<Color A="1" B="1" G="1" R="0"/>
|
||||||
<Radius>6</Radius>
|
<Radius>70</Radius>
|
||||||
<Intensity>0.5</Intensity>
|
<Intensity>0.5</Intensity>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="2.5"/>
|
<Position X="0" Y="0" Z="2.5"/>
|
||||||
|
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.obj</Resource>
|
||||||
|
<Color A="1" B="7.84313726" G="0" R="0"/>
|
||||||
|
</c:Model>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
<Color A="1" B="1" G="0.00784313772" R="0"/>
|
<Color A="1" B="1" G="0" R="0"/>
|
||||||
<Radius>8</Radius>
|
<Radius>70</Radius>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="0" Y="0" Z="5"/>
|
<Position X="0" Y="0" Z="5"/>
|
||||||
@@ -256,19 +345,28 @@
|
|||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.obj</Resource>
|
||||||
|
<Color A="1" B="7.84313726" G="7.84313726" R="7.84313726"/>
|
||||||
|
</c:Model>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
<Radius>6</Radius>
|
<Radius>70</Radius>
|
||||||
<Intensity>0.5</Intensity>
|
<Intensity>0.5</Intensity>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="2.5" Y="0" Z="0"/>
|
<Position X="2.5" Y="0" Z="0"/>
|
||||||
|
<Scale X="0.100000001" Y="0.100000001" Z="0.100000001"/>
|
||||||
</c:Transform>
|
</c:Transform>
|
||||||
</Components>
|
</Components>
|
||||||
<Children>
|
<Children>
|
||||||
<Entity>
|
<Entity>
|
||||||
<Components>
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Core/UnitSphere.obj</Resource>
|
||||||
|
<Color A="1" B="7.84313726" G="7.84313726" R="7.84313726"/>
|
||||||
|
</c:Model>
|
||||||
<c:PointLight>
|
<c:PointLight>
|
||||||
<Radius>8</Radius>
|
<Radius>70</Radius>
|
||||||
</c:PointLight>
|
</c:PointLight>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="5" Y="0" Z="0"/>
|
<Position X="5" Y="0" Z="0"/>
|
||||||
@@ -284,6 +382,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Assault.obj</Resource>
|
<Resource>Models/Assault.obj</Resource>
|
||||||
|
<Color A="1" B="1" G="1" R="3.92156863"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="2.5" Y="0" Z="1"/>
|
<Position X="2.5" Y="0" Z="1"/>
|
||||||
@@ -291,14 +390,15 @@
|
|||||||
</Components>
|
</Components>
|
||||||
<Children/>
|
<Children/>
|
||||||
</Entity>
|
</Entity>
|
||||||
<Entity>
|
<Entity name="DirectionalLight">
|
||||||
<Components>
|
<Components>
|
||||||
<c:DirectionalLight>
|
<c:DirectionalLight>
|
||||||
<Color A="1" B="0.996078432" G="1" R="1"/>
|
<Color A="1" B="0.996078432" G="1" R="1"/>
|
||||||
<Intensity>0.80000001192092896</Intensity>
|
<Intensity>0.10000000149011612</Intensity>
|
||||||
</c:DirectionalLight>
|
</c:DirectionalLight>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/DirectionalLightWidget.obj</Resource>
|
<Resource>Models/DirectionalLightWidget.obj</Resource>
|
||||||
|
<Color A="1" B="0" G="3.92156863" R="3.92156863"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-0.0013256073" Y="1.89540339" Z="6.53467274"/>
|
<Position X="-0.0013256073" Y="1.89540339" Z="6.53467274"/>
|
||||||
@@ -311,6 +411,7 @@
|
|||||||
<Components>
|
<Components>
|
||||||
<c:Model>
|
<c:Model>
|
||||||
<Resource>Models/Core/UnitCube.obj</Resource>
|
<Resource>Models/Core/UnitCube.obj</Resource>
|
||||||
|
<Color A="1" B="1" G="39.2156868" R="1"/>
|
||||||
</c:Model>
|
</c:Model>
|
||||||
<c:Transform>
|
<c:Transform>
|
||||||
<Position X="-5.4082036" Y="0" Z="-1.84950542"/>
|
<Position X="-5.4082036" Y="0" Z="-1.84950542"/>
|
||||||
|
|||||||
@@ -11,32 +11,12 @@ PlayerHUD::PlayerHUD(World* world, EventBroker* eventBrokerer)
|
|||||||
|
|
||||||
PlayerHUD::~PlayerHUD()
|
PlayerHUD::~PlayerHUD()
|
||||||
{
|
{
|
||||||
//
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerHUD::Update(double dt)
|
void PlayerHUD::Update(double dt)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(ImGui::Button("Set Camera", ImVec2(70, 20))){
|
|
||||||
auto cameras = m_World->GetComponents("Camera");
|
|
||||||
|
|
||||||
if(cameras == nullptr) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityWrapper ew = EntityWrapper(m_World, (*cameras->begin()).EntityID);
|
|
||||||
|
|
||||||
if (ew.Valid()) {
|
|
||||||
Events::SetCamera e;
|
|
||||||
e.CameraEntity = ew;
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
} else {
|
|
||||||
LOG_INFO("Coulnd't find a camera");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
auto healthHUDs = m_World->GetComponents("HealthHUD");
|
auto healthHUDs = m_World->GetComponents("HealthHUD");
|
||||||
if (healthHUDs == nullptr) {
|
if (healthHUDs == nullptr) {
|
||||||
return;
|
return;
|
||||||
@@ -57,14 +37,12 @@ void PlayerHUD::Update(double dt)
|
|||||||
if (entityIDParent.HasComponent("Health")) {
|
if (entityIDParent.HasComponent("Health")) {
|
||||||
|
|
||||||
if (entity.HasComponent("Text")) {
|
if (entity.HasComponent("Text")) {
|
||||||
|
|
||||||
std::string s = "";
|
std::string s = "";
|
||||||
s = s + std::to_string((int)(double)entityIDParent["Health"]["Health"]);
|
s = s + std::to_string((int)(double)entityIDParent["Health"]["Health"]);
|
||||||
s = s + "/";
|
s = s + "/";
|
||||||
s = s + std::to_string((int)(double)entityIDParent["Health"]["MaxHealth"]);
|
s = s + std::to_string((int)(double)entityIDParent["Health"]["MaxHealth"]);
|
||||||
|
|
||||||
float healthPercentage = (double)entityIDParent["Health"]["Health"]/(double)entityIDParent["Health"]["MaxHealth"];
|
float healthPercentage = (double)entityIDParent["Health"]["Health"]/(double)entityIDParent["Health"]["MaxHealth"];
|
||||||
(glm::vec4&) entity["Text"]["Color"] = glm::vec4(1.0 - healthPercentage, healthPercentage, 0.f, 0.f);
|
(glm::vec4&)entity["Text"]["Color"] = glm::vec4(1.0 - healthPercentage, 0.f, healthPercentage, 1.f);
|
||||||
entity["Text"]["Content"] = s;
|
entity["Text"]["Content"] = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user