[Orxonox-commit 6184] r10842 - in code/branches/fabienHS15: data/levels/templates data/overlays src/modules/overlays src/modules/overlays/hud
fvultier at orxonox.net
fvultier at orxonox.net
Mon Nov 23 17:45:13 CET 2015
Author: fvultier
Date: 2015-11-23 17:45:13 +0100 (Mon, 23 Nov 2015)
New Revision: 10842
Added:
code/branches/fabienHS15/src/modules/overlays/hud/HUDEnemyShieldBar.cc
code/branches/fabienHS15/src/modules/overlays/hud/HUDEnemyShieldBar.h
Modified:
code/branches/fabienHS15/data/levels/templates/spaceshipAssff2.oxt
code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo
code/branches/fabienHS15/src/modules/overlays/OverlaysPrereqs.h
code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt
code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.cc
code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.h
Log:
Modified: code/branches/fabienHS15/data/levels/templates/spaceshipAssff2.oxt
===================================================================
--- code/branches/fabienHS15/data/levels/templates/spaceshipAssff2.oxt 2015-11-23 16:01:15 UTC (rev 10841)
+++ code/branches/fabienHS15/data/levels/templates/spaceshipAssff2.oxt 2015-11-23 16:45:13 UTC (rev 10842)
@@ -36,6 +36,8 @@
mass = 100
linearDamping = 0.7
angularDamping = 0.9999999
+
+ explosionSound = "sounds/Explosion2.ogg"
>
<engines>
<MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine2 />
Modified: code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo 2015-11-23 16:01:15 UTC (rev 10841)
+++ code/branches/fabienHS15/data/overlays/HUDTemplates3.oxo 2015-11-23 16:45:13 UTC (rev 10842)
@@ -132,6 +132,20 @@
<BarColour position = 1.0 colour = "0.2,0.7,0.2" />
</HUDEnemyHealthBar>
+ <HUDEnemyShieldBar
+ name = "EnemyShieldBar1"
+ background = "Orxonox/BarBackground"
+ size = "0.40, 0.04"
+ position = "1.0 , 0.1 "
+ pickpoint = "1, 0"
+ correctaspect = true
+ iconmaterial = "Orxonox/BarIconShield"
+ >
+ <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
+ <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
+ <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
+ </HUDEnemyShieldBar>
+
<HUDNavigation
name = "Navigation"
correctaspect = true
Modified: code/branches/fabienHS15/src/modules/overlays/OverlaysPrereqs.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/OverlaysPrereqs.h 2015-11-23 16:01:15 UTC (rev 10841)
+++ code/branches/fabienHS15/src/modules/overlays/OverlaysPrereqs.h 2015-11-23 16:45:13 UTC (rev 10842)
@@ -92,6 +92,11 @@
class HUDShieldBar;
class HUDBoostBar;
class HUDRocketFuelBar;
+ class HUDEnemyHealthBar;
+ class HUDEnemyShieldBar;
+ class HUDWeaponSystem;
+ class HUDWeapon;
+ class HUDWeaponMode;
class HUDTimer;
class HUDAimAssistant;
class KillMessage;
Modified: code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt 2015-11-23 16:01:15 UTC (rev 10841)
+++ code/branches/fabienHS15/src/modules/overlays/hud/CMakeLists.txt 2015-11-23 16:45:13 UTC (rev 10842)
@@ -9,6 +9,7 @@
HUDRocketFuelBar.cc
HUDTimer.cc
HUDEnemyHealthBar.cc
+ HUDEnemyShieldBar.cc
HUDWeaponMode.cc
HUDWeapon.cc
HUDWeaponSystem.cc
Added: code/branches/fabienHS15/src/modules/overlays/hud/HUDEnemyShieldBar.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDEnemyShieldBar.cc (rev 0)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDEnemyShieldBar.cc 2015-11-23 16:45:13 UTC (rev 10842)
@@ -0,0 +1,89 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "HUDEnemyShieldBar.h"
+
+#include "core/config/ConfigValueIncludes.h"
+#include "worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+ RegisterClass(HUDEnemyShieldBar);
+
+ HUDEnemyShieldBar::HUDEnemyShieldBar(Context* context) : HUDShieldBar(context)
+ {
+ RegisterObject(HUDEnemyShieldBar);
+
+ this->setConfigValues();
+ this->owner_ = NULL;
+ }
+
+ HUDEnemyShieldBar::~HUDEnemyShieldBar()
+ {
+ }
+
+ void HUDEnemyShieldBar::setConfigValues()
+ {
+ SetConfigValue(useEnemyBar_, true);
+ }
+
+ void HUDEnemyShieldBar::tick(float dt)
+ {
+ this->updateTarget();
+
+ SUPER(HUDEnemyShieldBar, tick, dt);
+ }
+
+ void HUDEnemyShieldBar::updateTarget()
+ {
+ Pawn* pawn = NULL;
+ if (this->owner_ && this->useEnemyBar_)
+ {
+ // Get the owner's current target (target is usually a Model)
+ WorldEntity* target = this->owner_->getTarget();
+ // Find the Pawn that belongs to this target (if any)
+ while (target && !target->isA(Class(Pawn)))
+ target = target->getParent();
+ pawn = orxonox_cast<Pawn*>(target);
+ // Don't show the HealthBar if the pawn is invisible
+ if (pawn && !pawn->isVisible())
+ pawn = NULL;
+ }
+ // Set the pawn as owner of the HealthBar
+ this->setShieldBarOwner(pawn);
+ this->setVisible(pawn != NULL);
+ }
+
+ void HUDEnemyShieldBar::changedOwner()
+ {
+ SUPER(HUDEnemyShieldBar, changedOwner);
+
+ this->owner_ = orxonox_cast<ControllableEntity*>(this->getOwner());
+ this->updateTarget();
+ }
+}
Added: code/branches/fabienHS15/src/modules/overlays/hud/HUDEnemyShieldBar.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDEnemyShieldBar.h (rev 0)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDEnemyShieldBar.h 2015-11-23 16:45:13 UTC (rev 10842)
@@ -0,0 +1,58 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Fabien Vultier
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _HUDEnemyShieldBar_H__
+#define _HUDEnemyShieldBar_H__
+
+#include "HUDShieldBar.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ This class displays the shield status of the target enemy of it's owner.
+ */
+ class _OverlaysExport HUDEnemyShieldBar : public HUDShieldBar
+ {
+ public:
+ HUDEnemyShieldBar(Context* context);
+ virtual ~HUDEnemyShieldBar();
+
+ void setConfigValues();
+ virtual void tick(float dt);
+
+ void changedOwner();
+
+ private:
+ void updateTarget();
+
+ ControllableEntity* owner_;
+ bool useEnemyBar_;
+ };
+}
+#endif /* _HUDEnemyShieldBar_H__ */
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.cc
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.cc 2015-11-23 16:01:15 UTC (rev 10841)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.cc 2015-11-23 16:45:13 UTC (rev 10842)
@@ -53,7 +53,7 @@
if (this->owner_)
{
- float maxShieldHealth = this->owner_->getShieldHealth();
+ float maxShieldHealth = this->owner_->getMaxShieldHealth();
float shieldHealth = this->owner_->getShieldHealth();
if (maxShieldHealth > 0.0f)
@@ -65,6 +65,10 @@
this->setValue(0.0f);
}
}
+ else
+ {
+ this->setValue(0.0f);
+ }
}
void HUDShieldBar::changedOwner()
Modified: code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.h
===================================================================
--- code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.h 2015-11-23 16:01:15 UTC (rev 10841)
+++ code/branches/fabienHS15/src/modules/overlays/hud/HUDShieldBar.h 2015-11-23 16:45:13 UTC (rev 10842)
@@ -51,6 +51,8 @@
virtual void tick(float dt);
virtual void changedOwner();
+ inline void setShieldBarOwner(Pawn* owner)
+ { this->owner_ = owner; }
private:
Pawn* owner_;
};
More information about the Orxonox-commit
mailing list