Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2935


Ignore:
Timestamp:
Apr 27, 2009, 5:12:59 PM (16 years ago)
Author:
mockm
Message:

new revision of gametype UnderAttack

Location:
code/branches/gametypes/src/orxonox/objects
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gametypes/src/orxonox/objects/gametypes/UnderAttack.cc

    r2933 r2935  
    121121    void UnderAttack::tick(float dt)
    122122    {
    123         gameTime_ = gameTime_ - dt;
    124         if (gameTime_<= 0)
     123        SUPER(UnderAttack, tick, dt);
     124
     125        if (this->hasStarted())
    125126        {
    126             gameEnded_ = true;
    127             COUT(0) << "Time is up! Team 1 has won!" << std::endl;
     127            gameTime_ = gameTime_ - dt;
     128            if (gameTime_<= 0 && !gameEnded_)
     129            {
     130                gameEnded_ = true;
     131                COUT(0) << "Time is up! Team 1 has won!" << std::endl;
     132            }
    128133        }
    129134    }
  • code/branches/gametypes/src/orxonox/objects/worldentities/pawns/Destroyer.cc

    r2933 r2935  
    3939#include "core/XMLPort.h"
    4040#include "objects/items/Engine.h"
     41#include "objects/gametypes/UnderAttack.h"
    4142
    4243namespace orxonox
     
    4849        RegisterObject(Destroyer);
    4950
     51        UnderAttack* gametype = dynamic_cast<UnderAttack*>(this->getGametype());
     52        if (gametype)
     53        {
     54            gametype->addDestroyer(this);
     55        }
    5056    }
    5157
Note: See TracChangeset for help on using the changeset viewer.