Move Actor.DestroyChildren to C++

This commit is contained in:
Wojtek Figat
2022-04-13 21:34:13 +02:00
parent 3d76b2c10f
commit e554b7f531
3 changed files with 17 additions and 17 deletions

View File

@@ -418,6 +418,17 @@ Array<Actor*> Actor::GetChildren(const MClass* type) const
return result;
}
void Actor::DestroyChildren(float timeLeft)
{
Array<Actor*> children = Children;
const bool useGameTime = timeLeft > ZeroTolerance;
for (Actor* child : children)
{
child->SetParent(nullptr, false, false);
child->DeleteObject(timeLeft, useGameTime);
}
}
bool Actor::HasTag(const StringView& tag) const
{
return HasTag() && tag == Level::Tags[_tag];