Created
January 29, 2017 17:25
-
-
Save PoetaKodu/a9d4d4601b6169162e3a8005c74f4a78 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IPawn::IPawn(IPawnController * controller) | |
: m_controller(nullptr) | |
{ | |
if (controller && controller->Possess(this)) | |
{ | |
m_controller = controller; | |
} | |
} | |
///////////////////////////////////////////////////////////////////////// | |
IPawn::~IPawn() | |
{ | |
if(m_controller) | |
delete m_controller; | |
} | |
///////////////////////////////////////////////////////////////////////// | |
void IPawn::ResetController(IPawnController *controller) | |
{ | |
if (controller != m_controller) | |
{ | |
if(m_controller) | |
delete m_controller; | |
if (controller && controller->Possess(this)) | |
{ | |
m_controller = controller; | |
} | |
else | |
m_controller = nullptr; | |
} | |
} | |
///////////////////////////////////////////////////////////////////////// | |
void IPawn::Update(const float & deltaTime) | |
{ | |
if(m_controller) | |
m_controller->Update(deltaTime); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment