Units now only shown in slider of modal as Integer

This commit is contained in:
Chauntalle Schüle 2020-06-08 18:40:20 +02:00 committed by Marcel Schwarz
parent 00f8fbc61a
commit f871bfda1d

View File

@ -16,7 +16,7 @@ class GameScene: SKScene{
var isMoveTouch = false var isMoveTouch = false
var currentDraggedBase : Base? var currentDraggedBase : Base?
static var sendUnits: CGFloat = 0 static var sendUnits: Int = 0
var collisionBase: Base? var collisionBase: Base?
override func sceneDidLoad() { override func sceneDidLoad() {
@ -113,7 +113,7 @@ class GameScene: SKScene{
touchLocation: touchLocation, touchLocation: touchLocation,
collisionBase: collisionBase) collisionBase: collisionBase)
) )
GameScene.sendUnits = CGFloat(currentDraggedBase!.unitCount / 2) GameScene.sendUnits = Int(currentDraggedBase!.unitCount / 2)
} }
} }
} }
@ -123,7 +123,7 @@ class GameScene: SKScene{
for e in entityManager.entities{ for e in entityManager.entities{
if let modal = e as? Modal { if let modal = e as? Modal {
if modal.type == ModalType.BaseAttack || modal.type == ModalType.BaseMoveOwnUnits { if modal.type == ModalType.BaseAttack || modal.type == ModalType.BaseMoveOwnUnits {
GameScene.sendUnits = ((e.component(ofType: SliderComponent.self)?.sliderNode.getValue ?? 0) * CGFloat((e as! Modal).unitCount)).rounded(.up) GameScene.sendUnits = Int(((e.component(ofType: SliderComponent.self)?.sliderNode.getValue ?? 0) * CGFloat((e as! Modal).unitCount)).rounded(.up))
//TODO: refactor this quick and dirty fix //TODO: refactor this quick and dirty fix
if GameScene.sendUnits == 0 { if GameScene.sendUnits == 0 {