2014-02-25 14:36:54 +01:00
|
|
|
#include "Pickup.h"
|
2014-02-25 16:10:02 +01:00
|
|
|
#include "../Game.h"
|
2014-02-25 14:36:54 +01:00
|
|
|
|
|
|
|
using namespace GameLogic;
|
|
|
|
|
|
|
|
Pickup::Pickup(Oyster::Physics::ICustomBody *rigidBody, EventOnCollision collisionFunc, ObjectSpecialType type, int objectID, Oyster::Math::Float spawnTime)
|
|
|
|
: StaticObject(rigidBody, collisionFunc, type, objectID)
|
|
|
|
{
|
|
|
|
this->active = true;
|
|
|
|
this->spawnTime = spawnTime;
|
2014-02-25 16:10:02 +01:00
|
|
|
timer.reset();
|
2014-02-25 14:36:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Pickup::~Pickup()
|
|
|
|
{}
|
|
|
|
|
|
|
|
void Pickup::Update()
|
|
|
|
{
|
|
|
|
if(!active)
|
|
|
|
{
|
|
|
|
if(timer.getElapsedSeconds() >= spawnTime)
|
|
|
|
{
|
|
|
|
active = true;
|
2014-02-25 16:10:02 +01:00
|
|
|
((Game*)&Game::Instance())->onEnableFnc(this);
|
2014-02-25 14:36:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Pickup::IsActive()
|
|
|
|
{
|
|
|
|
return active;
|
|
|
|
}
|