[Orxonox-commit 5594] r10256 - in code/branches/presentationHS14merge/src/modules: mini4dgame towerdefense
landauf at orxonox.net
landauf at orxonox.net
Thu Feb 5 23:21:35 CET 2015
Author: landauf
Date: 2015-02-05 23:21:35 +0100 (Thu, 05 Feb 2015)
New Revision: 10256
Modified:
code/branches/presentationHS14merge/src/modules/mini4dgame/Mini4DgamePrereqs.h
code/branches/presentationHS14merge/src/modules/towerdefense/TowerDefenseEnemy.cc
code/branches/presentationHS14merge/src/modules/towerdefense/TowerDefenseEnemy.h
Log:
found some hidden changes in a merge commit in presentationHS14 and applied it to this branch.
cleanup in Mini4DgamePrereqs.h
Modified: code/branches/presentationHS14merge/src/modules/mini4dgame/Mini4DgamePrereqs.h
===================================================================
--- code/branches/presentationHS14merge/src/modules/mini4dgame/Mini4DgamePrereqs.h 2015-02-04 21:21:28 UTC (rev 10255)
+++ code/branches/presentationHS14merge/src/modules/mini4dgame/Mini4DgamePrereqs.h 2015-02-05 22:21:35 UTC (rev 10256)
@@ -29,7 +29,7 @@
/**
@file
@brief
- Shared library macros, enums, constants and forward declarations for the pong module
+ Shared library macros, enums, constants and forward declarations for the mini4dgame module
*/
#ifndef _Mini4DgamePrereqs_H__
@@ -71,4 +71,4 @@
class Mini4DgameBoard;
}
-#endif /* _PongPrereqs_H__ */
+#endif /* _Mini4DgamePrereqs_H__ */
Modified: code/branches/presentationHS14merge/src/modules/towerdefense/TowerDefenseEnemy.cc
===================================================================
--- code/branches/presentationHS14merge/src/modules/towerdefense/TowerDefenseEnemy.cc 2015-02-04 21:21:28 UTC (rev 10255)
+++ code/branches/presentationHS14merge/src/modules/towerdefense/TowerDefenseEnemy.cc 2015-02-05 22:21:35 UTC (rev 10256)
@@ -29,11 +29,12 @@
this->setCollisionType(WorldEntity::Dynamic);
//needed to keep track of the PlayerStats coded in TowerDefense.h
this->td = orxonox_cast<TowerDefense*>(this->getGametype().get());
+ once_=false;
}
//add credit if enemy is destroyed
TowerDefenseEnemy::~TowerDefenseEnemy(){
- this->td->addCredit(1);
+ //this->td->addCredit(1);
}
void TowerDefenseEnemy::addWaypoint(TDCoordinate* coord)
@@ -47,6 +48,25 @@
SUPER(TowerDefenseEnemy, tick, dt);
}
+ WeakPtr<TowerDefense> TowerDefenseEnemy::getGame()
+ {
+ if (game == NULL)
+ {
+ for (ObjectList<TowerDefense>::iterator it = ObjectList<TowerDefense>::begin(); it != ObjectList<TowerDefense>::end(); ++it)
+ game = *it;
+ }
+ return game;
+ }
+
+ void TowerDefenseEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
+ {
+ Pawn::damage(damage, healthdamage, shielddamage, originator);
+ if (getGame() && once_ == false && getHealth() <= 0)
+ {
+ getGame()->addCredit(1);
+ once_ = true;
+ }
+ }
/*
void TowerDefenseEnemy::popWaypoint()
{
Modified: code/branches/presentationHS14merge/src/modules/towerdefense/TowerDefenseEnemy.h
===================================================================
--- code/branches/presentationHS14merge/src/modules/towerdefense/TowerDefenseEnemy.h 2015-02-04 21:21:28 UTC (rev 10255)
+++ code/branches/presentationHS14merge/src/modules/towerdefense/TowerDefenseEnemy.h 2015-02-05 22:21:35 UTC (rev 10256)
@@ -42,8 +42,12 @@
void popWaypoint();
TDCoordinate peekWaypoint();
+ virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator);
+
private:
+ WeakPtr<TowerDefense> getGame();
+ WeakPtr<TowerDefense> game;
TowerDefense* td;
bool once_;
std::vector<TDCoordinate*> Waypointsvector_;
More information about the Orxonox-commit
mailing list