Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/towerdefense/TowerDefenseEnemy.cc @ 11592

Last change on this file since 11592 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
RevLine 
[10109]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    */
[10126]19    TowerDefenseEnemy::TowerDefenseEnemy(Context* context) : SpaceShip(context)
[10109]20    {
21        RegisterObject(TowerDefenseEnemy);
22
[11071]23        this->setCollisionType(WorldEntity::CollisionType::Dynamic);
[10172]24        //needed to keep track of the PlayerStats coded in TowerDefense.h
[10624]25        this->td = orxonox_cast<TowerDefense*>(this->getGametype());
[10629]26        once_ = false;
[10109]27    }
[10622]28
[10629]29    TowerDefenseEnemy::~TowerDefenseEnemy()
30    {
[10109]31
32    }
[10132]33
[10629]34    WeakPtr<TowerDefense> TowerDefenseEnemy::getGame()
[10256]35    {
[11071]36        if (game == nullptr)
[10256]37        {
[11071]38            for (TowerDefense* towerDefense : ObjectList<TowerDefense>())
39                game = towerDefense;
[10256]40        }
41        return game;
42    }
43
[11071]44    void TowerDefenseEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs)
[10256]45    {
[10629]46        Pawn::damage(damage, healthdamage, shielddamage, originator);
47       
[10256]48        if (getGame() && once_ == false && getHealth() <= 0)
49        {
50            getGame()->addCredit(1);
51            once_ = true;
52        }
53    }
[10109]54}
Note: See TracBrowser for help on using the repository browser.