From f871bfda1d5c061ee2151a9071dbee82d0ab0a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chauntalle=20Schu=CC=88le?= Date: Mon, 8 Jun 2020 18:40:20 +0200 Subject: [PATCH] Units now only shown in slider of modal as Integer --- GoldWars/GoldWars/Scenes/GameScene.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GoldWars/GoldWars/Scenes/GameScene.swift b/GoldWars/GoldWars/Scenes/GameScene.swift index 9bb380c..c2f1d1a 100644 --- a/GoldWars/GoldWars/Scenes/GameScene.swift +++ b/GoldWars/GoldWars/Scenes/GameScene.swift @@ -16,7 +16,7 @@ class GameScene: SKScene{ var isMoveTouch = false var currentDraggedBase : Base? - static var sendUnits: CGFloat = 0 + static var sendUnits: Int = 0 var collisionBase: Base? override func sceneDidLoad() { @@ -113,7 +113,7 @@ class GameScene: SKScene{ touchLocation: touchLocation, 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{ if let modal = e as? Modal { 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 if GameScene.sendUnits == 0 {