changes after review

This commit is contained in:
Chauntalle Schüle 2020-06-23 18:55:47 +02:00
parent 23cd0ade20
commit a52e4cd8d1
4 changed files with 6 additions and 12 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 132 KiB

After

Width:  |  Height:  |  Size: 132 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 88 KiB

View File

@ -68,7 +68,7 @@ class EntityManager {
} }
if let rulesEntity = entity as? Rules { if let rulesEntity = entity as? Rules {
scene.addChild(rulesEntity.node) scene.addChild(rulesEntity.image)
} }
if let wayEntity = entity as? Way { if let wayEntity = entity as? Way {
@ -374,7 +374,7 @@ class EntityManager {
func removeRules(){ func removeRules(){
entities.forEach({entity in entities.forEach({entity in
if let rules = entity as? Rules { if let rules = entity as? Rules {
rules.node.removeFromParent() rules.image.removeFromParent()
if let button = rules.component(ofType: ButtonComponent.self) { if let button = rules.component(ofType: ButtonComponent.self) {
button.buttonNode.removeFromParent() button.buttonNode.removeFromParent()

View File

@ -39,7 +39,6 @@ class RulesScene: SKScene {
onButtonPress: { onButtonPress: {
EntityManager.rulesEMInstance.removeRules() EntityManager.rulesEMInstance.removeRules()
EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesSpiel")) EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesSpiel"))
})) }))
EntityManager.rulesEMInstance.add(Button(name: "Basen", EntityManager.rulesEMInstance.add(Button(name: "Basen",
textureName: "yellow_button13", textureName: "yellow_button13",
@ -48,7 +47,6 @@ class RulesScene: SKScene {
onButtonPress: { onButtonPress: {
EntityManager.rulesEMInstance.removeRules() EntityManager.rulesEMInstance.removeRules()
EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesBasen")) EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesBasen"))
})) }))
EntityManager.rulesEMInstance.add(Button(name: "Einheiten", EntityManager.rulesEMInstance.add(Button(name: "Einheiten",
textureName: "yellow_button13", textureName: "yellow_button13",
@ -57,7 +55,6 @@ class RulesScene: SKScene {
onButtonPress: { onButtonPress: {
EntityManager.rulesEMInstance.removeRules() EntityManager.rulesEMInstance.removeRules()
EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesEinheiten")) EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesEinheiten"))
})) }))
EntityManager.rulesEMInstance.add(Button(name: "Spielende", EntityManager.rulesEMInstance.add(Button(name: "Spielende",
textureName: "yellow_button13", textureName: "yellow_button13",
@ -66,7 +63,6 @@ class RulesScene: SKScene {
onButtonPress: { onButtonPress: {
EntityManager.rulesEMInstance.removeRules() EntityManager.rulesEMInstance.removeRules()
EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesSpielende")) EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesSpielende"))
})) }))
EntityManager.rulesEMInstance.add(Button(name: "Boost", EntityManager.rulesEMInstance.add(Button(name: "Boost",
textureName: "yellow_button13", textureName: "yellow_button13",
@ -75,7 +71,6 @@ class RulesScene: SKScene {
onButtonPress: { onButtonPress: {
EntityManager.rulesEMInstance.removeRules() EntityManager.rulesEMInstance.removeRules()
EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesBoost")) EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesBoost"))
})) }))
EntityManager.rulesEMInstance.add(Button(name: "Erfolge", EntityManager.rulesEMInstance.add(Button(name: "Erfolge",
textureName: "yellow_button13", textureName: "yellow_button13",
@ -84,7 +79,6 @@ class RulesScene: SKScene {
onButtonPress: { onButtonPress: {
EntityManager.rulesEMInstance.removeRules() EntityManager.rulesEMInstance.removeRules()
EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesErfolge")) EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesErfolge"))
})) }))
EntityManager.rulesEMInstance.add(Background(size: self.size)) EntityManager.rulesEMInstance.add(Background(size: self.size))
EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesSpiel")) EntityManager.rulesEMInstance.add(Rules(rulesScene: self, textureName: "RulesSpiel"))
@ -105,13 +99,13 @@ class RulesScene: SKScene {
class Rules: GKEntity { class Rules: GKEntity {
var node: SKSpriteNode var image: SKSpriteNode
init(rulesScene: RulesScene, textureName: String) { init(rulesScene: RulesScene, textureName: String) {
let texture = SKTexture(imageNamed: textureName) let texture = SKTexture(imageNamed: textureName)
node = SKSpriteNode(texture: texture, size: CGSize(width: rulesScene.size.width * 0.8, height: rulesScene.size.height * 0.8)) image = SKSpriteNode(texture: texture, size: CGSize(width: rulesScene.size.width * 0.8, height: rulesScene.size.height * 0.8))
node.position = CGPoint(x: rulesScene.size.width * 0.6, y: rulesScene.size.height * 0.6 - 150) image.position = CGPoint(x: rulesScene.size.width * 0.6, y: rulesScene.size.height * 0.6 - 150)
node.zPosition = 4 image.zPosition = 4
super.init() super.init()
} }