/********************************************************************
*
* File: fsCEphemeralComponent.h
*
* Purpose: Keep an entity alive until....
*
*********************************************************************/
#ifndef fsCEphemeralComponenthdr
#define fsCEphemeralComponenthdr
//#include <functional>
#include "fsIComponent.h"
class fsCEphemeralComponent : public fsIComponent
{
friend fsCComponentFactory;
public:
class fsFncCondition
{
public:
virtual fsBool operator()(fsCEntity* pParent) = 0;
virtual ~fsFncCondition()
{
}
};
static const fsCUniqueId mTypeId;
// void init(std::function< fsBool (fsCEntity* const pParent) > pCondition);
void init(fsFncCondition* pCondition);
protected:
void updateDo(fsS32 pDeltaMs) override;
static fsIComponent* create(fsCEntity* pParent);
fsCEphemeralComponent(fsCEntity* pParent);
~fsCEphemeralComponent();<--- Destructor in derived class
private:
// std::function< fsBool (fsCEntity* const pParent) > mCondition;
fsFncCondition* mCondition;
};
#endif