Danbias/Code/Game/GameLogic/PickupSystem/Pickup.cpp

33 lines
628 B
C++
Raw Normal View History

2014-02-25 14:36:54 +01:00
#include "Pickup.h"
#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;
timer.reset();
2014-02-26 10:23:38 +01:00
this->GetRigidBody()->MoveToLimbo();
2014-02-25 14:36:54 +01:00
}
Pickup::~Pickup()
{}
void Pickup::Update()
{
if(!active)
{
if(timer.getElapsedSeconds() >= spawnTime)
{
active = true;
((Game*)&Game::Instance())->onEnableFnc(this);
2014-02-25 14:36:54 +01:00
}
}
}
bool Pickup::IsActive()
{
return active;
}