Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
90 lines (56 sloc) 1.07 KB
#pragma once
#include "Active.h"
#include "ActiveContainerManager.h"
class Active;
class ActiveContainer
{
public:
ActiveContainer()
:m_pCurrentActive(NULL)
{}
virtual ~ActiveContainer()
{
if(m_pCurrentActive!=NULL)
{
ActiveContainerManager::getSingleton().removeContainer(this);
//m_pCurrentActive->end();
SafeDelete(m_pCurrentActive);
}
}
/**Ö´Ðж¯×÷*/
void runActive(Active* pActive)
{
assert(m_pCurrentActive==NULL);
assert(pActive);
m_pCurrentActive=pActive;
ActiveContainerManager::getSingleton().addContainer(this);
}
/**·µ»Øfalse±íʾÍê³É*/
bool updateActive(float time)
{
return m_pCurrentActive->update(time);
}
void begin()
{
m_pCurrentActive->begin();
}
void end()
{
m_pCurrentActive->end();
SafeDelete(m_pCurrentActive);
}
bool hasActive()const
{
return m_pCurrentActive!=NULL;
}
void stopAndRemoveActive()
{
if(m_pCurrentActive!=NULL)
{
ActiveContainerManager::getSingleton().removeContainer(this);
SafeDelete(m_pCurrentActive);
}
}
protected:
Active* m_pCurrentActive;
};
Something went wrong with that request. Please try again.