Sdk/Entity: Add IsDying method

This commit is contained in:
Jérôme Leclercq
2018-07-17 10:51:35 +02:00
parent 6dfc866a4d
commit 7b6cc47e03
5 changed files with 62 additions and 3 deletions

View File

@@ -324,13 +324,34 @@ namespace Ndk
KillEntity(entity);
}
/*!
* \brief Checks whether or not an entity is dying (has been killed this update)
* \return true If the entity exists and is dying
*
* \param entity Pointer to the entity
*/
inline bool World::IsEntityDying(const Entity* entity) const
{
return entity && IsEntityDying(entity->GetId());
}
/*!
* \brief Checks whether or not an entity is dying (has been killed this update)
* \return true If it is the case, false if the entity is alive (and hasn't been killed yet) or if the entity id is invalid
*
* \param id Identifier of the entity
*/
inline bool World::IsEntityDying(EntityId id) const
{
return m_killedEntities.UnboundedTest(id);
}
/*!
* \brief Checks whether or not an entity is valid
* \return true If it is the case
*
* \param entity Pointer to the entity
*/
inline bool World::IsEntityValid(const Entity* entity) const
{
return entity && entity->GetWorld() == this && IsEntityIdValid(entity->GetId());