Made the hurt hazard work better.
This commit is contained in:
@ -175,6 +175,15 @@ Transform * Transform::getParent() {
|
||||
return this->parent;
|
||||
}
|
||||
|
||||
bool_t Transform::isChildOf(Transform *parent) {
|
||||
Transform *current = this->getParent();
|
||||
while(current != nullptr) {
|
||||
if(current == parent) return true;
|
||||
current = current->getParent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Transform::~Transform() {
|
||||
this->setParent(nullptr);
|
||||
|
||||
|
@ -162,6 +162,15 @@ namespace Dawn {
|
||||
*/
|
||||
Transform * getParent();
|
||||
|
||||
/**
|
||||
* Returns true if this transform is a child of the given transform, this
|
||||
* climbs up the heirarchy until it finds a match.
|
||||
*
|
||||
* @param p Transform to check if this transform is a child of.
|
||||
* @return True if this transform is a child of the given transform.
|
||||
*/
|
||||
bool_t isChildOf(Transform *p);
|
||||
|
||||
/**
|
||||
* Dispose and clenaup this transform, also removes self from parent.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user