diff --git a/GoldWars/GoldWars/Entities/EntityManager.swift b/GoldWars/GoldWars/Entities/EntityManager.swift index 0f7166c..6c92437 100644 --- a/GoldWars/GoldWars/Entities/EntityManager.swift +++ b/GoldWars/GoldWars/Entities/EntityManager.swift @@ -30,7 +30,7 @@ class EntityManager { } if let spriteNode = entity.component(ofType: ModalBackgroundComponent.self)?.spriteNode { scene.addChild(spriteNode) - isModal = true + //isModal = true } if let modal = entity.component(ofType: ModalContentComponent.self) { scene.addChild(modal.header) @@ -54,6 +54,7 @@ class EntityManager { } if let buttonNode = entity.component(ofType: ButtonComponent.self)?.buttonNode { scene.addChild(buttonNode) + isModal = true } if let nodes = entity.component(ofType: BackgroundComponent.self)?.nodes { for node in nodes { @@ -72,7 +73,7 @@ class EntityManager { } if let spriteNode = entity.component(ofType: ModalBackgroundComponent.self)?.spriteNode { spriteNode.removeFromParent() - isModal = false + //isModal = false } if let modal = entity.component(ofType: ModalContentComponent.self) { modal.header.removeFromParent() @@ -83,6 +84,10 @@ class EntityManager { sliderNode.sliderKnob.removeFromParent() sliderNode.sliderLine.removeFromParent() } + if let modalButton = entity.component(ofType: ButtonComponent.self) { + modalButton.buttonNode.removeFromParent() + isModal = false + } entities.remove(entity) }