Fix slider min max unit values

This commit is contained in:
Aldin Duraki 2020-05-20 23:36:48 +02:00
parent 5f7b12c28c
commit a8c42fa0b0
2 changed files with 5 additions and 1 deletions

View File

@ -58,6 +58,7 @@ class Modal: GKEntity{
for base in currentDraggedBase!.adjacencyList {
if base == collisionBase {
EntityManager.sharedInstance.update((currentDraggedBase?.doPlayerMoveTypeToBase(base: base, playerMoveType: PlayerMoveType.AtkMove, units: Int(GameScene.sendUnits)))!)
GameScene.sendUnits = 0
}
}
}

View File

@ -93,6 +93,7 @@ class GameScene: SKScene{
base: entity as! Base,
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
gameScene: self, currentDraggedBase: currentDraggedBase, touchLocation: touchLocation, collisionBase: collisionBase))
}
}
}
@ -106,6 +107,8 @@ class GameScene: SKScene{
base: currentDraggedBase!,
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
gameScene: self, currentDraggedBase: currentDraggedBase, touchLocation: touchLocation, collisionBase: collisionBase))
GameScene.sendUnits = CGFloat(currentDraggedBase!.unitCount / 2)
}
}
}
@ -115,7 +118,7 @@ class GameScene: SKScene{
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
//TODO: quick fix chauntalle die olle mach augen auf
if GameScene.sendUnits == 0 {
GameScene.sendUnits = 1
} else if Int(GameScene.sendUnits) == currentDraggedBase?.unitCount {