Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/QuestGuide_HS16/src/modules/towerdefense/TowerDefenseEnemy.cc @ 11475

Last change on this file since 11475 was 11099, checked in by muemart, 9 years ago

Fix loads of doxygen warnings and other documentation issues

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1//
2//  TowerDefenseEnemy.cc
3//  Orxonox
4//
5//  Created by Jonas Erb on 22.10.14.
6
7#include "TowerDefenseEnemy.h"
8#include "core/CoreIncludes.h"
9//#include "core/XMLPort.h"
10
11namespace orxonox
12{
13    RegisterClass(TowerDefenseEnemy);
14
15    /**
16    @brief
17        Constructor. Registers and initializes the object.
18    */
19    TowerDefenseEnemy::TowerDefenseEnemy(Context* context) : SpaceShip(context)
20    {
21        RegisterObject(TowerDefenseEnemy);
22
23        this->setCollisionType(WorldEntity::CollisionType::Dynamic);
24        //needed to keep track of the PlayerStats coded in TowerDefense.h
25        this->td = orxonox_cast<TowerDefense*>(this->getGametype());
26        once_ = false;
27    }
28
29    TowerDefenseEnemy::~TowerDefenseEnemy()
30    {
31
32    }
33
34    WeakPtr<TowerDefense> TowerDefenseEnemy::getGame()
35    {
36        if (game == nullptr)
37        {
38            for (TowerDefense* towerDefense : ObjectList<TowerDefense>())
39                game = towerDefense;
40        }
41        return game;
42    }
43
44    void TowerDefenseEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
45    {
46        Pawn::damage(damage, healthdamage, shielddamage, originator);
47       
48        if (getGame() && once_ == false && getHealth() <= 0)
49        {
50            getGame()->addCredit(1);
51            once_ = true;
52        }
53    }
54}
Note: See TracBrowser for help on using the repository browser.