missing change from last commit

This commit is contained in:
Diren D Bharwani 2022-11-13 17:57:46 +08:00
parent c953931f4f
commit c98693c6bc
1 changed files with 17 additions and 17 deletions

View File

@ -128,15 +128,15 @@ namespace SHADE
void SHPhysicsSystem::AddCollisionShape(EntityID eid, int shapeIndex) void SHPhysicsSystem::AddCollisionShape(EntityID eid, int shapeIndex)
{ {
static const auto ADD_SHAPE = [&] static const auto ADD_SHAPE = [&](EntityID entityID, int index)
{ {
objectManager.AddCollisionShape(eid, shapeIndex); objectManager.AddCollisionShape(entityID, index);
const SHPhysicsColliderAddedEvent COLLIDER_ADDED_EVENT_DATA const SHPhysicsColliderAddedEvent COLLIDER_ADDED_EVENT_DATA
{ {
.entityID = eid .entityID = entityID
, .colliderType = SHComponentManager::GetComponent<SHColliderComponent>(eid)->GetCollisionShape(shapeIndex).GetType() , .colliderType = SHComponentManager::GetComponent<SHColliderComponent>(entityID)->GetCollisionShape(index).GetType()
, .colliderIndex = shapeIndex , .colliderIndex = index
}; };
SHEventManager::BroadcastEvent<SHPhysicsColliderAddedEvent>(COLLIDER_ADDED_EVENT_DATA, SH_PHYSICS_COLLIDER_ADDED_EVENT); SHEventManager::BroadcastEvent<SHPhysicsColliderAddedEvent>(COLLIDER_ADDED_EVENT_DATA, SH_PHYSICS_COLLIDER_ADDED_EVENT);
@ -144,27 +144,27 @@ namespace SHADE
#ifdef SHEDITOR #ifdef SHEDITOR
auto* editor = SHSystemManager::GetSystem<SHEditor>(); const auto* EDITOR = SHSystemManager::GetSystem<SHEditor>();
if (editor && editor->editorState != SHEditor::State::STOP) if (EDITOR && EDITOR->editorState != SHEditor::State::STOP)
ADD_SHAPE(); ADD_SHAPE(eid, shapeIndex);
#else #else
ADD_SHAPE(); ADD_SHAPE(eid, shapeIndex);
#endif #endif
} }
void SHPhysicsSystem::RemoveCollisionShape(EntityID eid, int shapeIndex) void SHPhysicsSystem::RemoveCollisionShape(EntityID eid, int shapeIndex)
{ {
static const auto REMOVE_SHAPE = [&] static const auto REMOVE_SHAPE = [&](EntityID entityID, int index)
{ {
objectManager.RemoveCollisionShape(eid, shapeIndex); objectManager.RemoveCollisionShape(entityID, index);
const SHPhysicsColliderRemovedEvent COLLIDER_REMOVED_EVENT_DATA const SHPhysicsColliderRemovedEvent COLLIDER_REMOVED_EVENT_DATA
{ {
.entityID = eid .entityID = entityID
, .colliderIndex = shapeIndex , .colliderIndex = index
}; };
SHEventManager::BroadcastEvent<SHPhysicsColliderRemovedEvent>(COLLIDER_REMOVED_EVENT_DATA, SH_PHYSICS_COLLIDER_REMOVED_EVENT); SHEventManager::BroadcastEvent<SHPhysicsColliderRemovedEvent>(COLLIDER_REMOVED_EVENT_DATA, SH_PHYSICS_COLLIDER_REMOVED_EVENT);
@ -172,13 +172,13 @@ namespace SHADE
#ifdef SHEDITOR #ifdef SHEDITOR
auto* editor = SHSystemManager::GetSystem<SHEditor>(); const auto* EDITOR = SHSystemManager::GetSystem<SHEditor>();
if (editor && editor->editorState != SHEditor::State::STOP) if (EDITOR && EDITOR->editorState != SHEditor::State::STOP)
REMOVE_SHAPE(); REMOVE_SHAPE(eid, shapeIndex);
#else #else
REMOVE_SHAPE(); REMOVE_SHAPE(eid, shapeIndex);
#endif #endif
} }