Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 15, 2014, 3:58:14 PM (10 years ago)
Author:
maxima
Message:

towerdefenseHS14 merged.

Location:
code/branches/presentationHS14
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS14

  • code/branches/presentationHS14/src/modules/towerdefense/TowerDefenseHUDController.cc

    r9667 r10181  
    3232#include "util/Convert.h"
    3333
    34 
    3534namespace orxonox
    3635{
     
    4039    {
    4140        RegisterObject(TowerDefenseHUDController);
     41        this->td = 0;
    4242    }
    4343
     
    5050    {
    5151        SUPER(TowerDefenseHUDController, tick, dt);
     52        const std::string& lifes = multi_cast<std::string>(this->td->getLifes());
     53        const std::string& credits = multi_cast<std::string>(this->td->getCredit());
     54        const std::string& wave = multi_cast<std::string>(this->td->getWaveNumber());
     55
     56        if(showlives == true)
     57          this->setCaption(multi_cast<std::string>(lifes));
     58        else if(showcredits == true)
     59          this->setCaption(multi_cast<std::string>(credits));
     60        else if(showwaves == true)
     61          this->setCaption(multi_cast<std::string>(wave));
     62
     63
    5264    }
    5365
     
    5567    {
    5668        SUPER(TowerDefenseHUDController, XMLPort, xmlelement, mode);
     69
     70        XMLPortParam(TowerDefenseHUDController, "showlives", setShowlives, getShowlives, xmlelement, mode);
     71        XMLPortParam(TowerDefenseHUDController, "showcredits", setShowcredits, getShowcredits, xmlelement, mode);
     72        XMLPortParam(TowerDefenseHUDController, "showwaves", setShowwaves, getShowwaves, xmlelement, mode);
     73
    5774    }
    5875
    5976    void TowerDefenseHUDController::changedOwner()
    60     {
    61         SUPER(TowerDefenseHUDController, changedOwner);
    62         /*
    63         if (this->getOwner() != NULL && this->getOwner()->getGametype())
    64             this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype().get());
    65         else
    66             this->owner_ = 0;
    67         */
    68     }
     77        {
     78            SUPER(TowerDefenseHUDController, changedOwner);
    6979
    70 }
     80            if (this->getOwner() && this->getOwner()->getGametype())
     81                    {
     82                        this->td = orxonox_cast<TowerDefense*>(this->getOwner()->getGametype().get());
     83                    }
     84                    else
     85                    {
     86                        this->td = 0;
     87                    }
     88                }
     89        }
     90
Note: See TracChangeset for help on using the changeset viewer.