#include "Effect.h" Effect::Effect( Spieler *zSpieler, float maxTime ) { this->zSpieler = zSpieler; timeLeft = maxTime; effectImage = 0; ref = 1; } Effect::~Effect() { if( effectImage ) effectImage->release(); } bool Effect::tick( double time, Spiel *zSpiel ) { timeLeft -= (float)time; return timeLeft <= 0; } bool Effect::istSpielerBeweglich( Richtung r ) const { return 1; } bool Effect::istSpielerVerwundbar( Richtung r ) const { return 1; } bool Effect::istSpielerSichtbar( Team *zTeam ) const { return 1; } bool Effect::istIntersectable() const { return 1; } void Effect::move( Richtung r, double time ) {} bool Effect::istGegenstandErlaubt( GegenstandTyp typ ) const { return 1; } void Effect::renderSpieler( Bild &rObj ) {} bool Effect::renderEffect( int x, int y, int width, int height, Bild & rObj, Schrift * zSchrift ) { if( !effectImage ) return 0; rObj.alphaBildSkall( x, y, width, height, *effectImage ); TextRenderer tr; tr.setSchriftZ( zSchrift->getThis() ); tr.setSchriftSize( 12 ); tr.renderText( x + 5, y + 5, Text( (int)(timeLeft * 100) / 100.0 ), rObj, 0xFFFFFFFF ); return 1; } Resource *Effect::getCurrentResource() { return 0; } Effect *Effect::getThis() { ref++; return this; } Effect *Effect::release() { if( !--ref ) delete this; return 0; }