diff --git a/laser tag.xcodeproj/project.pbxproj b/laser tag.xcodeproj/project.pbxproj
index 3b0c1b5..eb6044b 100644
--- a/laser tag.xcodeproj/project.pbxproj
+++ b/laser tag.xcodeproj/project.pbxproj
@@ -484,7 +484,7 @@
CODE_SIGN_ENTITLEMENTS = "laser tag/laser tag.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 1;
+ CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = KG885U9N7S;
INFOPLIST_FILE = "laser tag/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.5;
@@ -511,7 +511,7 @@
CODE_SIGN_ENTITLEMENTS = "laser tag/laser tag.entitlements";
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 1;
+ CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = KG885U9N7S;
INFOPLIST_FILE = "laser tag/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 13.5;
diff --git a/laser tag.xcworkspace/xcuserdata/aarushbothra.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/laser tag.xcworkspace/xcuserdata/aarushbothra.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
index 1b7684f..2b34d64 100644
--- a/laser tag.xcworkspace/xcuserdata/aarushbothra.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+++ b/laser tag.xcworkspace/xcuserdata/aarushbothra.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
@@ -30,8 +30,8 @@
filePath = "laser tag/View Controllers/LobbyVC.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "160"
- endingLineNumber = "160"
+ startingLineNumber = "159"
+ endingLineNumber = "159"
landmarkName = "collectionView(_:cellForItemAt:)"
landmarkType = "7">
@@ -202,8 +202,8 @@
filePath = "laser tag/View Controllers/LobbyVC.swift"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "162"
- endingLineNumber = "162"
+ startingLineNumber = "161"
+ endingLineNumber = "161"
landmarkName = "collectionView(_:cellForItemAt:)"
landmarkType = "7">
diff --git a/laser tag/Base.lproj/Main.storyboard b/laser tag/Base.lproj/Main.storyboard
index a613645..d05e787 100644
--- a/laser tag/Base.lproj/Main.storyboard
+++ b/laser tag/Base.lproj/Main.storyboard
@@ -996,6 +996,7 @@
+
@@ -1014,7 +1015,7 @@
-
+
@@ -1077,7 +1078,7 @@
-
+
@@ -1301,6 +1302,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/laser tag/Handlers/BluetoothHandler.swift b/laser tag/Handlers/BluetoothHandler.swift
index 819c95c..b61b17d 100644
--- a/laser tag/Handlers/BluetoothHandler.swift
+++ b/laser tag/Handlers/BluetoothHandler.swift
@@ -89,6 +89,8 @@ class BluetoothHandler: NSObject {
var execute = true
+ var possibleGuns = [Gun]()
+
public func initializeCentraManager(){
print("initializing")
centralManager = CBCentralManager(delegate: self, queue: nil)
@@ -146,21 +148,63 @@ extension BluetoothHandler: CBCentralManagerDelegate {
public func connectToGun() {
- self.centralManager.scanForPeripherals(withServices: [gunServiceUUID])
+ self.centralManager.scanForPeripherals(withServices: [self.gunServiceUUID])
+
+ let progress = Progress(totalUnitCount: 10)
+
+ Timer.scheduledTimer(withTimeInterval: 0.1, repeats: true){ (timer) in
+
+ guard progress.isFinished == false else {
+ timer.invalidate()
+ print("attempting connection")
+ if self.possibleGuns.count > 0 {
+ var peripheralToConnect = self.possibleGuns[0]
+ for gun in self.possibleGuns {
+ print(Int(gun.RSSI))
+ print(gun.peripheral.identifier)
+ if Int(gun.RSSI) > Int(peripheralToConnect.RSSI) {
+ peripheralToConnect = gun
+ }
+ }
+ print("Peripheral To Connect: \(peripheralToConnect.peripheral.identifier)")
+ //self.possibleGuns.sorted(by: {Int($0.RSSI) < Int($1.RSSI)})
+ print("connecting")
+ self.laserTagGun = peripheralToConnect.peripheral
+ //points the peripheral to its delegate function
+ self.laserTagGun.delegate = self
+ self.centralManager.connect(self.laserTagGun)
+
+ }
+ return
+ }
+
+ progress.completedUnitCount += 1
+
+
+ }
}
+
//function called after manager has found gun
+
public func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
- centralManager.stopScan()
- //peripheral is gun
- print(peripheral)
- laserTagGun = peripheral
+ //centralManager.stopScan()
+ print("scanning")
+ if possibleGuns.count == 0 {
+ possibleGuns.append(Gun(peripheral: peripheral, RSSI: RSSI))
+ //print(peripheral)
+ } else {
+ for gun in possibleGuns {
+ if gun.peripheral.identifier != peripheral.identifier {
+ possibleGuns.append(Gun(peripheral: peripheral, RSSI: RSSI))
+ //print(peripheral)
+ }
+ }
+ }
- //points the peripheral to its delegate function
- laserTagGun.delegate = self
+ //peripheral is gun
- centralManager.connect(laserTagGun)
}
@@ -375,7 +419,11 @@ extension BluetoothHandler: CBPeripheralDelegate{
//handleGame.resetHealth()
execute = false
}
-
+ case 4:
+ if networking.gameStarted && !handleGame.isDead {
+ NFCRead.readNFCTag()
+ execute = false
+ }
default:
break
}
@@ -418,4 +466,8 @@ extension BluetoothHandler: CBPeripheralDelegate{
}
+struct Gun {
+ let peripheral: CBPeripheral
+ let RSSI: NSNumber
+}
diff --git a/laser tag/Handlers/GameHandler.swift b/laser tag/Handlers/GameHandler.swift
index b3814ee..96deaba 100644
--- a/laser tag/Handlers/GameHandler.swift
+++ b/laser tag/Handlers/GameHandler.swift
@@ -35,7 +35,7 @@ class GameHandler {
var gameViewController: GameHandlerDelegate!
- var gameTime = Double(Game.timeLimit*60)
+ var gameTimeElapsed = Double(0)
var timer = Timer()
var playerSelf: Player!
@@ -56,10 +56,14 @@ class GameHandler {
let dummyPlayer = Player(username: "dummy", team: -1, gunType: -1, gunID: -1, isSelf: false, kills: -1, deaths: -1, score: -1)
//time oddball is first recieved
+ var timeAtOddballRecieved: Int!
+ var oddballReceived = false
var playerWithOddball: Player!
- var oddballTimer = Timer()
- var oddballTimeElapsed = 0
+ var scoreIncremented = false
+ var isRespawning = false
+ var timeRespawnedAt: Double!
+ var respawnInvincibilityDelay = 1.5
init() {
for player in Players {
@@ -71,80 +75,99 @@ class GameHandler {
}
- func timerStart(){
+ func gameTimeStart(){
//print("starting timer")
- timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(handleTimerLabel), userInfo: nil, repeats: true)
+ timer = Timer.scheduledTimer(timeInterval: 0.1, target: self, selector: #selector(handleGameTime), userInfo: nil, repeats: true)
let runLoop = RunLoop.current
runLoop.add(timer, forMode: .default)
runLoop.run()
}
- @objc func handleTimerLabel(){
- let timerString = timerHandler()
- //print("handling timer")
- DispatchQueue.main.async {
- self.gameViewController.setTimerLabel(string: timerString)
- }
-
- }
-
- func timerHandler() -> String {
-
- gameTime -= 0.1
- // print(timerCounter)
-
- let flooredCounter = Int(gameTime)
- let hour = flooredCounter/3600
+ @objc func handleGameTime() {
- let minute = (flooredCounter % 3600) / 60
- var minuteString = "\(minute)"
- if minute < 10 {
- minuteString = "0\(minute)"
- }
+ gameTimeElapsed += 0.1
- let second = (flooredCounter % 3600) % 60
- var secondString = "\(second)"
- if second < 10 {
- secondString = "0\(second)"
+ if Game.timeLimit > 0 {
+ let flooredCounter = Int(Double((Game.timeLimit * 60)) - gameTimeElapsed)
+ let hour = flooredCounter/3600
+
+ let minute = (flooredCounter % 3600) / 60
+ var minuteString = "\(minute)"
+ if minute < 10 {
+ minuteString = "0\(minute)"
+ }
+
+ let second = (flooredCounter % 3600) % 60
+ var secondString = "\(second)"
+ if second < 10 {
+ secondString = "0\(second)"
+ }
+
+ let decisecond = String(format: "%.1f", Double((Game.timeLimit * 60)) - gameTimeElapsed).components(separatedBy: ".").last!
+
+
+ if Int(gameTimeElapsed) % 10 == 0 && networking.isAdmin {
+ if sendTimeSync {
+ sendTimeSync = false
+ let coefficient = Int(gameTimeElapsed / 255)
+ let remainder = Int(gameTimeElapsed) % 255
+ print("SYNCING TIME: coefficient: \(coefficient), remainder: \(remainder), gameTimeElapsed: \(gameTimeElapsed) ")
+ networking.syncTime(coefficient: coefficient, remainder: Int(remainder))
+ }
+
+ } else {
+ sendTimeSync = true
+ }
+
+ var timeString: String
+ if flooredCounter >= 0 {
+ //only display hour if there are more than 60 minutes and only display minutes if there are more than 60 seconds
+ if flooredCounter > 3600{
+
+ timeString = "\(hour):\(minuteString):\(secondString)"
+ } else if flooredCounter > 60 {
+
+ timeString = "\(minuteString):\(secondString)"
+ } else {
+
+ timeString = "\(secondString).\(decisecond)"
+ }
+
+ DispatchQueue.main.async {
+ self.gameViewController.setTimerLabel(string: timeString)
+ }
+ } else if flooredCounter < 0 {
+ timer.invalidate()
+ DispatchQueue.main.async {
+ networking.endGame()
+ }
+
+ }
}
- let decisecond = String(format: "%.1f", gameTime).components(separatedBy: ".").last!
-
-
- if ((Game.timeLimit * 60) - Int(gameTime)) % 10 == 0 && networking.isAdmin {
- if sendTimeSync {
- sendTimeSync = false
- let coefficient = Int(gameTime / 255)
- let remainder = Int(gameTime) % 255
- print("SYNCING TIME: coefficient: \(coefficient), remainder: \(remainder), gameTime: \(gameTime) ")
- networking.syncTime(coefficient: coefficient, remainder: Int(remainder))
+ if oddballReceived {
+ if (Int(gameTimeElapsed) - timeAtOddballRecieved) % 5 == 0 {
+ if !scoreIncremented {
+ networking.scoreIncrease()
+ scoreIncremented = true
+ }
+
+ } else {
+ scoreIncremented = false
}
-
- } else {
- sendTimeSync = true
}
- if flooredCounter >= 0 {
- //only display hour if there are more than 60 minutes and only display minutes if there are more than 60 seconds
- if flooredCounter > 3600{
+ if isRespawning {
+
+ if (gameTimeElapsed - timeRespawnedAt) >= respawnInvincibilityDelay {
- return "\(hour):\(minuteString):\(secondString)"
- } else if flooredCounter > 60 {
+ isDead = false
+ isRespawning = false
- return "\(minuteString):\(secondString)"
- } else {
- return "\(secondString).\(decisecond)"
}
- } else if flooredCounter < 0 {
- timer.invalidate()
- DispatchQueue.main.async {
- networking.endGame()
- }
-
}
- return ""
}
// handles respawning as well as refilling ammo and health
@@ -153,8 +176,12 @@ class GameHandler {
//playerSelf.shield = 0
playerSelf.totalAmmo = Game.ammo
gameViewController.setHealthBar()
- isDead = false
handleReload()
+
+ if isDead {
+ timeRespawnedAt = gameTimeElapsed
+ isRespawning = true
+ }
}
func onPlayerHit(gunID: Int){
@@ -164,76 +191,30 @@ class GameHandler {
if gunID == player.gunID {
print("found player shooting")
playerShooting = player
+ break
+ } else {
+ playerShooting = dummyPlayer
}
}
print(playerSelf.health)
- if Game.teamSetting == 0 {
- if playerSelf.shield > 0 {
- switch playerShooting.gunType {
- case 0://sniper
- playerSelf.shield -= sniperDamage
- case 1://burst
- playerSelf.shield -= burstDamage
- case 2://full auto
- playerSelf.shield -= fullAutoDamage
- case 3://single shot
- playerSelf.shield -= singleShotDamage
- default:
- break;
- }
- gameViewController.setShieldBar()
- gameViewController.flashRed()
- } else {
- switch playerShooting.gunType {
- case 0://sniper
- playerSelf.health -= sniperDamage
- case 1://burst
- playerSelf.health -= burstDamage
- case 2://full auto
- playerSelf.health -= fullAutoDamage
- case 3://single shot
- playerSelf.health -= singleShotDamage
- default:
- break;
- }
-
-
-
- if playerSelf.health <= 0 {
- networking.sendPlayerKilled(shooterGunID: playerShooting.gunID, selfGunID: playerSelf.gunID)
- bluetooth.syncGun()
- bluetooth.setReload(gunID: playerSelf.gunID)
- isDead = true
- gameViewController.setHealthBar()
- // gameViewController.switchToDeathScreen(string: "Killed by \(playerShooting.username)")
- //bluetooth.syncGun()
-
- } else {
- networking.sendPlayerHit(shooterGunID: playerShooting.gunID, selfGunID: playerSelf.gunID)
+ if playerShooting.gunID != -1 {
+ if Game.teamSetting == 0 {
+ if playerSelf.shield > 0 {
+ switch playerShooting.gunType {
+ case 0://sniper
+ playerSelf.shield -= sniperDamage
+ case 1://burst
+ playerSelf.shield -= burstDamage
+ case 2://full auto
+ playerSelf.shield -= fullAutoDamage
+ case 3://single shot
+ playerSelf.shield -= singleShotDamage
+ default:
+ break;
+ }
+ gameViewController.setShieldBar()
gameViewController.flashRed()
- gameViewController.setHealthBar()
- }
- }
-
-
- } else {
- if playerSelf.shield > 0 {
- switch playerShooting.gunType {
- case 0://sniper
- playerSelf.shield -= sniperDamage
- case 1://burst
- playerSelf.shield -= burstDamage
- case 2://full auto
- playerSelf.shield -= fullAutoDamage
- case 3://single shot
- playerSelf.shield -= singleShotDamage
- default:
- break;
- }
- gameViewController.setShieldBar()
- gameViewController.flashRed()
- } else {
- if playerShooting.team != playerSelf.team {
+ } else {
switch playerShooting.gunType {
case 0://sniper
playerSelf.health -= sniperDamage
@@ -251,12 +232,11 @@ class GameHandler {
if playerSelf.health <= 0 {
networking.sendPlayerKilled(shooterGunID: playerShooting.gunID, selfGunID: playerSelf.gunID)
- bluetooth.syncGun()
+ // bluetooth.syncGun()
bluetooth.setReload(gunID: playerSelf.gunID)
- gameViewController.setHealthBar()
- // gameViewController.switchToDeathScreen(string: "Killed by \(playerShooting.username)")
-
isDead = true
+ gameViewController.setHealthBar()
+ // gameViewController.switchToDeathScreen(string: "Killed by \(playerShooting.username)")
//bluetooth.syncGun()
} else {
@@ -265,9 +245,62 @@ class GameHandler {
gameViewController.setHealthBar()
}
}
+
+
+ } else {
+ if playerSelf.shield > 0 {
+ switch playerShooting.gunType {
+ case 0://sniper
+ playerSelf.shield -= sniperDamage
+ case 1://burst
+ playerSelf.shield -= burstDamage
+ case 2://full auto
+ playerSelf.shield -= fullAutoDamage
+ case 3://single shot
+ playerSelf.shield -= singleShotDamage
+ default:
+ break;
+ }
+ gameViewController.setShieldBar()
+ gameViewController.flashRed()
+ } else {
+ if playerShooting.team != playerSelf.team {
+ switch playerShooting.gunType {
+ case 0://sniper
+ playerSelf.health -= sniperDamage
+ case 1://burst
+ playerSelf.health -= burstDamage
+ case 2://full auto
+ playerSelf.health -= fullAutoDamage
+ case 3://single shot
+ playerSelf.health -= singleShotDamage
+ default:
+ break;
+ }
+
+
+
+ if playerSelf.health <= 0 {
+ networking.sendPlayerKilled(shooterGunID: playerShooting.gunID, selfGunID: playerSelf.gunID)
+ // bluetooth.syncGun()
+ bluetooth.setReload(gunID: playerSelf.gunID)
+ gameViewController.setHealthBar()
+ // gameViewController.switchToDeathScreen(string: "Killed by \(playerShooting.username)")
+
+ isDead = true
+ //bluetooth.syncGun()
+
+ } else {
+ networking.sendPlayerHit(shooterGunID: playerShooting.gunID, selfGunID: playerSelf.gunID)
+ gameViewController.flashRed()
+ gameViewController.setHealthBar()
+ }
+ }
+ }
}
}
}
+
}
func handleReload(){
@@ -372,7 +405,7 @@ class GameHandler {
if Game.gameType == 0 {
createInGameTableViews()
-
+
if Game.scoreLimit > 0 {
if Game.teamSetting > 0 {
let teams = createTeams()
@@ -411,10 +444,8 @@ class GameHandler {
if playerWithOddball.gunID == playerSelf.gunID {
playerSelf.shield = 100
- DispatchQueue.global(qos: .utility).async {
- self.startOddballTimer()
- }
-
+ oddballReceived = true
+ timeAtOddballRecieved = Int(gameTimeElapsed)
DispatchQueue.main.async {
self.gameViewController.setBackgroundWhite()
}
@@ -428,32 +459,12 @@ class GameHandler {
}
- func startOddballTimer() {
- oddballTimer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(handleOddballTimer), userInfo: nil, repeats: true)
- let runLoop = RunLoop.current
- runLoop.add(oddballTimer, forMode: .default)
- runLoop.run()
- }
-
- @objc func handleOddballTimer() {
- oddballTimeElapsed += 1
-
- if oddballTimeElapsed % 5 == 0 {
- networking.scoreIncrease()
- }
- }
-
func scoreIncrease(gunID: Int) {
for player in Players {
if player.gunID == gunID {
player.score += 1
if player.score == 255 || player.score == Game.scoreLimit{
- if Game.timeLimit > 0 {
- timer.invalidate()
- }
- if player.isSelf {
- oddballTimer.invalidate()
- }
+ timer.invalidate()
networking.endGame()
}
}
@@ -467,8 +478,7 @@ class GameHandler {
func oddballLost() {
playerWithOddball = dummyPlayer
- oddballTimer.invalidate()
-
+ oddballReceived = false
DispatchQueue.main.async {
self.createInGameTableViews()
self.gameViewController.setBackgroundNormal()
diff --git a/laser tag/Handlers/NFCReadHandler.swift b/laser tag/Handlers/NFCReadHandler.swift
index c998309..f282b92 100644
--- a/laser tag/Handlers/NFCReadHandler.swift
+++ b/laser tag/Handlers/NFCReadHandler.swift
@@ -32,13 +32,6 @@ class NFCReadHandler: NSObject, NFCNDEFReaderSessionDelegate {
readSession.begin()
}
- func readRefillAmmoAndHealth() {
- readType = 1
- readSession = NFCNDEFReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: true)
- readSession?.alertMessage = "Hold your phone near the respawn NFC tag"
- readSession.begin()
- }
-
func readServerAddressTag(){
readType = 2
readSession = NFCNDEFReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: true)
@@ -46,13 +39,12 @@ class NFCReadHandler: NSObject, NFCNDEFReaderSessionDelegate {
readSession.begin()
}
- func readOddballTag() {
- readType = 3
+ func readNFCTag () {
+ readType = -1
readSession = NFCNDEFReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: true)
- readSession?.alertMessage = "Hold your phone near the oddball NFC tag"
+ readSession?.alertMessage = "Hold your phone near a NFC tag"
readSession.begin()
}
-
func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {}
func readerSessionDidBecomeActive(_ session: NFCNDEFReaderSession) {}
@@ -71,23 +63,33 @@ class NFCReadHandler: NSObject, NFCNDEFReaderSessionDelegate {
case 0:
if nfcMessage == "respawn"{
self.deathScreenNFC.respawn()
- }
- case 1:
- if nfcMessage == "respawn" {
- handleGame.respawn()
+ } else {
+ session.alertMessage = "Invalid NFC Tag"
}
case 2:
if String(nfcMessage[.. 0 {
- handleGame.timer.invalidate()
- }
+
+ handleGame.timer.invalidate()
+
DispatchQueue.main.async {
- self.inGameVCTCP.gameOver()
+ if self.activeVC == "inGame" {
+ self.inGameVCTCP.gameOver()
+ }
bluetooth.disconnectGun()
}
case 9:
if gameStarted {
- handleGame.gameTime = Double((serverMessage[1] * 255) + serverMessage[2])
+ handleGame.gameTimeElapsed = Double((serverMessage[1] * 255) + serverMessage[2])
}
case 10:
diff --git a/laser tag/View Controllers/AlertVCs/ShowPlusOptions.swift b/laser tag/View Controllers/AlertVCs/ShowPlusOptions.swift
index b9e5324..ff4369d 100644
--- a/laser tag/View Controllers/AlertVCs/ShowPlusOptions.swift
+++ b/laser tag/View Controllers/AlertVCs/ShowPlusOptions.swift
@@ -31,13 +31,13 @@ class ShowPlusOptions: UIViewController {
}
@IBAction func refillButton(_ sender: Any) {
- NFCRead.readRefillAmmoAndHealth()
- dismiss(animated: true)
+// NFCRead.readRefillAmmoAndHealth()
+// dismiss(animated: true)
}
@IBAction func claimOddballButton(_ sender: Any) {
- NFCRead.readOddballTag()
- dismiss(animated: true)
+// NFCRead.readOddballTag()
+// dismiss(animated: true)
}
/*
// MARK: - Navigation
diff --git a/laser tag/View Controllers/AlertVCs/StartingCountdownVC.swift b/laser tag/View Controllers/AlertVCs/StartingCountdownVC.swift
index 87ca889..e70cc2d 100644
--- a/laser tag/View Controllers/AlertVCs/StartingCountdownVC.swift
+++ b/laser tag/View Controllers/AlertVCs/StartingCountdownVC.swift
@@ -9,7 +9,7 @@
import UIKit
class StartingCountdownVC: UIViewController {
-
+
@IBOutlet var startingCountdownLabel: UILabel!
var timer: Timer!
var counter = 0
@@ -28,26 +28,21 @@ class StartingCountdownVC: UIViewController {
if counter == 5 {
self.timer.invalidate()
dismiss(animated: true)
- if Game.timeLimit > 0{
-
- DispatchQueue.global(qos: .userInteractive).async {
- handleGame.timerStart()
- }
-
-
+ DispatchQueue.global(qos: .userInteractive).async {
+ handleGame.gameTimeStart()
}
handleGame.handleReload()
}
}
-
+
/*
- // MARK: - Navigation
-
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- // Get the new view controller using segue.destination.
- // Pass the selected object to the new view controller.
- }
- */
-
+ // MARK: - Navigation
+
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+ // Get the new view controller using segue.destination.
+ // Pass the selected object to the new view controller.
+ }
+ */
+
}
diff --git a/laser tag/View Controllers/InGameVC.swift b/laser tag/View Controllers/InGameVC.swift
index 092e1a7..a24ddf1 100644
--- a/laser tag/View Controllers/InGameVC.swift
+++ b/laser tag/View Controllers/InGameVC.swift
@@ -40,6 +40,7 @@ class InGameVC: UIViewController, BTDelegateInGame, TCPDelegateInGame, GameHandl
override func viewDidLoad() {
super.viewDidLoad()
+
handleGame = GameHandler()
bluetooth.activeVC = "inGame"
@@ -77,9 +78,6 @@ class InGameVC: UIViewController, BTDelegateInGame, TCPDelegateInGame, GameHandl
if Game.timeLimit == 0 {
timerLabel.text = "Unlimited"
}
-
-
-
}
func setTimerLabel(string: String) {
@@ -158,12 +156,13 @@ class InGameVC: UIViewController, BTDelegateInGame, TCPDelegateInGame, GameHandl
}
@IBAction func plusButton(_ sender: Any) {
- let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
-
- let showPlusOptionsVC = mainStoryboard.instantiateViewController(identifier: "ShowPlusOptionsVC") as! ShowPlusOptions
-
- present(showPlusOptionsVC, animated: true)
- print("presenting plus options")
+// let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
+//
+// let showPlusOptionsVC = mainStoryboard.instantiateViewController(identifier: "ShowPlusOptionsVC") as! ShowPlusOptions
+//
+// present(showPlusOptionsVC, animated: true)
+// print("presenting plus options")
+ NFCRead.readNFCTag()
}
@IBAction func minusButton(_ sender: Any) {
@@ -187,10 +186,11 @@ class InGameVC: UIViewController, BTDelegateInGame, TCPDelegateInGame, GameHandl
}
func gameOver() {
+ bluetooth.disconnectGun()
let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let gameOverVC = mainStoryboard.instantiateViewController(identifier: "GameOverVC") as! GameOverVC
- bluetooth.disconnectGun()
+
self.navigationController?.pushViewController(gameOverVC, animated: true)
print("switching to gameOverVC")
diff --git a/laser tag/View Controllers/LobbyVC.swift b/laser tag/View Controllers/LobbyVC.swift
index bf8f5d8..059dbdd 100644
--- a/laser tag/View Controllers/LobbyVC.swift
+++ b/laser tag/View Controllers/LobbyVC.swift
@@ -88,7 +88,6 @@ class LobbyVC: UIViewController, BTDelegateLobby, TCPDelegateLobby {
let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)
let inGameVC = mainStoryboard.instantiateViewController(identifier: "InGameVC") as! InGameVC
-
self.navigationController?.pushViewController(inGameVC, animated: true)
print("switching to inGameVC")
}