Adding modalButton to Entity Manager

This commit is contained in:
Chauntalle Schüle 2020-05-14 14:04:25 +02:00 committed by Chauntalle Schüle
parent a3361b3752
commit a78b9269c0

View File

@ -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)
}