Move Actor.DestroyChildren to C++
This commit is contained in:
@@ -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];
|
||||
|
||||
@@ -296,23 +296,6 @@ namespace FlaxEngine
|
||||
return output;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destroys the children. Calls Object.Destroy on every child actor and unlink them for the parent.
|
||||
/// </summary>
|
||||
/// <param name="timeLeft">The time left to destroy object (in seconds).</param>
|
||||
[NoAnimate]
|
||||
public void DestroyChildren(float timeLeft = 0.0f)
|
||||
{
|
||||
if (ChildrenCount == 0)
|
||||
return;
|
||||
Actor[] children = Children;
|
||||
for (var i = 0; i < children.Length; i++)
|
||||
{
|
||||
children[i].Parent = null;
|
||||
Destroy(children[i], timeLeft);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the matrix that transforms a point from the world space to local space of the actor.
|
||||
/// </summary>
|
||||
|
||||
@@ -242,6 +242,12 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Destroys the children. Calls Object.Destroy on every child actor and unlinks them for this actor.
|
||||
/// </summary>
|
||||
/// <param name="timeLeft">The time left to destroy object (in seconds).</param>
|
||||
API_FUNCTION(Attributes="NoAnimate") void DestroyChildren(float timeLeft = 0.0f);
|
||||
|
||||
public:
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user