#include "Schalter.h" #include "Spiel.h" Schalter::Schalter( ResourceRegistry *zResources, int id, int x, int y, int width, int height, bool aktive ) : GameObject( SCHALTER, x, y, width, height ) { this->id = id; this->aktiv = aktive; aktivierungen = 0; texturScale = 1; textur = dynamic_cast( zResources->zResource( R_SCHALTER, 0 )->getImages()->getThis() ); } void Schalter::setAktive( bool aktiv ) { this->aktiv = aktiv; } void Schalter::press( Spiel *zSpiel ) { zSpiel->setSchalterZuletztAktiviert( dynamic_cast( getThis() ) ); aktivierungen++; Ereignis *e = new Ereignis( SCHALTER_AKTIVIERT ); e->addParameter( "Betroffener Schalter", dynamic_cast( getThis() ) ); zSpiel->throwEvent( e ); } void Schalter::render( Bild &rObj ) { if( !aktiv ) rObj.setAlpha( 0x77 ); GameObject::render( rObj ); if( !aktiv ) rObj.releaseAlpha(); } int Schalter::getAnzahlAktivierungen() const { return aktivierungen; } bool Schalter::isAktive() const { return aktiv; } int Schalter::getId() const { return id; }