* Changed slider behavior to not take MAX and 0 value as unit counts to send

This commit is contained in:
Aldin Duraki 2020-05-20 23:20:05 +02:00
parent 458d50e4b3
commit 5f7b12c28c
2 changed files with 8 additions and 2 deletions

View File

@ -25,8 +25,7 @@ class AtkBoostSkillComponent: GKComponent{
}else {
base.unitType = .Attack
}
}
})
}})
super.init()
}

View File

@ -114,6 +114,13 @@ class GameScene: SKScene{
for e in EntityManager.sharedInstance.entities{
if let body = e.component(ofType: ModalContentComponent.self)?.body{
GameScene.sendUnits = ((e.component(ofType: SliderComponent.self)?.sliderNode.getValue ?? 0) * CGFloat((e as! Modal).unitCount)).rounded(.up)
//TODO: refactor this quick and dirty fix
if GameScene.sendUnits == 0 {
GameScene.sendUnits = 1
} else if Int(GameScene.sendUnits) == currentDraggedBase?.unitCount {
GameScene.sendUnits -= 1
}
body.text = "Schicke \(GameScene.sendUnits) Einheiten "
}
}