#include <electrifier.hpp>
Inherits GameObject.
Public Member Functions | |
Electrifier (uint32_t oldtile, uint32_t newtile, float seconds) | |
~Electrifier () | |
Protected Member Functions | |
virtual void | update (float time) |
This function is called once per frame and allows the object to update it's state. | |
virtual void | draw (DrawingContext &context) |
The GameObject should draw itself onto the provided DrawingContext if this function is called. | |
Private Attributes | |
uint32_t | change_from |
uint32_t | change_to |
Timer | duration |
Definition at line 26 of file electrifier.hpp.
Electrifier::Electrifier | ( | uint32_t | oldtile, | |
uint32_t | newtile, | |||
float | seconds | |||
) |
Definition at line 20 of file electrifier.cpp.
References change_from, Sector::change_solid_tiles(), change_to, Sector::current(), duration, and Timer::start().
00020 : 00021 change_from(), 00022 change_to(), 00023 duration() 00024 { 00025 duration.start(seconds); 00026 change_from = oldtile; 00027 change_to = newtile; 00028 Sector::current()->change_solid_tiles(change_from,change_to); 00029 }
Electrifier::~Electrifier | ( | ) |
void Electrifier::update | ( | float | time | ) | [protected, virtual] |
This function is called once per frame and allows the object to update it's state.
The elapsed_time is the time since the last frame in seconds and should be the base for all timed calculations (don't use SDL_GetTicks directly as this will fail in pause mode)
Implements GameObject.
Definition at line 35 of file electrifier.cpp.
References change_from, Sector::change_solid_tiles(), change_to, Timer::check(), Sector::current(), duration, and GameObject::remove_me().
00036 { 00037 if (duration.check()) { 00038 Sector::current()->change_solid_tiles(change_to,change_from); 00039 remove_me(); 00040 } 00041 }
void Electrifier::draw | ( | DrawingContext & | context | ) | [protected, virtual] |
The GameObject should draw itself onto the provided DrawingContext if this function is called.
Implements GameObject.
Definition at line 44 of file electrifier.cpp.
uint32_t Electrifier::change_from [private] |
uint32_t Electrifier::change_to [private] |
Timer Electrifier::duration [private] |