pull request fix
This commit is contained in:
parent
bd2d3d25ec
commit
28cbbac00f
|
|
@ -0,0 +1,21 @@
|
|||
disabled_rules:
|
||||
- variable_name
|
||||
excluded:
|
||||
- Carthage
|
||||
- Pods
|
||||
line_length: 128
|
||||
type_body_length:
|
||||
- 500 # warning
|
||||
- 700 # error
|
||||
file_length:
|
||||
warning: 500
|
||||
error: 1200
|
||||
warning_threshold: 1
|
||||
|
||||
custom_rules:
|
||||
uiwebview_disabled:
|
||||
included: ".*.swift"
|
||||
name: "UIWebView Usage Disabled"
|
||||
regex: "(UIWebView)"
|
||||
message: "Do not use UIWebView. Use WKWebView Instead. https://developer.apple.com/reference/uikit/uiwebview"
|
||||
severity: error
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
exclude:
|
||||
- 'Pods'
|
||||
- 'Carthage'
|
||||
|
|
@ -94,6 +94,8 @@
|
|||
0AC0DA3A1EE99233006E2CC9 /* Sources */,
|
||||
0AC0DA3B1EE99233006E2CC9 /* Frameworks */,
|
||||
0AC0DA3C1EE99233006E2CC9 /* Resources */,
|
||||
0AA8505A1EF3FB4E00353B55 /* SwiftLint */,
|
||||
0AA8505B1EF3FBE200353B55 /* Tailor */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
|
@ -151,6 +153,37 @@
|
|||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
0AA8505A1EF3FB4E00353B55 /* SwiftLint */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = SwiftLint;
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi";
|
||||
};
|
||||
0AA8505B1EF3FBE200353B55 /* Tailor */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = Tailor;
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "if hash tailor 2>/dev/null; then\ntailor\nfi";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
0AC0DA3A1EE99233006E2CC9 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
|
|
@ -303,7 +336,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = com.touchInstinct.ARTest;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TARGETED_DEVICE_FAMILY = 1;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
|
@ -317,7 +350,7 @@
|
|||
PRODUCT_BUNDLE_IDENTIFIER = com.touchInstinct.ARTest;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_VERSION = 4.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
TARGETED_DEVICE_FAMILY = 1;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,38 +23,13 @@
|
|||
import UIKit
|
||||
|
||||
@UIApplicationMain
|
||||
class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
final class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
|
||||
var window: UIWindow?
|
||||
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
// Override point for customization after application launch.
|
||||
func application(_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func applicationWillResignActive(_ application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
func applicationDidEnterBackground(_ application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.17" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.17" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.14"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
|
|
@ -12,10 +13,6 @@
|
|||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
|
|
@ -50,16 +47,17 @@
|
|||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="HKg-Br-WkV" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" constant="-50" id="0vc-uU-83H"/>
|
||||
<constraint firstItem="2jk-ie-pkn" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1R6-Iy-sOb"/>
|
||||
<constraint firstItem="qsj-bS-o2r" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="10" id="1kI-0n-tPp"/>
|
||||
<constraint firstItem="6LN-bt-MQx" firstAttribute="top" secondItem="Llm-lL-Icb" secondAttribute="bottom" constant="8" id="3yF-pL-AIg"/>
|
||||
<constraint firstItem="2jk-ie-pkn" firstAttribute="centerX" secondItem="IxU-Gn-Xag" secondAttribute="centerX" id="1R6-Iy-sOb"/>
|
||||
<constraint firstItem="qsj-bS-o2r" firstAttribute="leading" secondItem="IxU-Gn-Xag" secondAttribute="leading" constant="10" id="1kI-0n-tPp"/>
|
||||
<constraint firstItem="2jk-ie-pkn" firstAttribute="top" secondItem="HKg-Br-WkV" secondAttribute="bottom" constant="30" id="CUp-ke-9bM"/>
|
||||
<constraint firstAttribute="trailing" secondItem="HKg-Br-WkV" secondAttribute="trailing" constant="10" id="F6S-c2-3dv"/>
|
||||
<constraint firstItem="6LN-bt-MQx" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="fuk-Pj-kVC"/>
|
||||
<constraint firstAttribute="trailing" secondItem="qsj-bS-o2r" secondAttribute="trailing" constant="10" id="iCr-Rb-ZJu"/>
|
||||
<constraint firstItem="HKg-Br-WkV" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" constant="10" id="tR9-M5-o1x"/>
|
||||
<constraint firstItem="xb3-aO-Qok" firstAttribute="top" secondItem="qsj-bS-o2r" secondAttribute="bottom" constant="8" id="zP3-nK-wLN"/>
|
||||
<constraint firstItem="IxU-Gn-Xag" firstAttribute="trailing" secondItem="HKg-Br-WkV" secondAttribute="trailing" constant="10" id="F6S-c2-3dv"/>
|
||||
<constraint firstItem="6LN-bt-MQx" firstAttribute="centerX" secondItem="IxU-Gn-Xag" secondAttribute="centerX" id="fuk-Pj-kVC"/>
|
||||
<constraint firstItem="IxU-Gn-Xag" firstAttribute="trailing" secondItem="qsj-bS-o2r" secondAttribute="trailing" constant="10" id="iCr-Rb-ZJu"/>
|
||||
<constraint firstItem="6LN-bt-MQx" firstAttribute="top" secondItem="IxU-Gn-Xag" secondAttribute="top" constant="8" id="rkl-LO-AuQ"/>
|
||||
<constraint firstItem="HKg-Br-WkV" firstAttribute="leading" secondItem="IxU-Gn-Xag" secondAttribute="leading" constant="10" id="tR9-M5-o1x"/>
|
||||
<constraint firstItem="IxU-Gn-Xag" firstAttribute="bottom" secondItem="qsj-bS-o2r" secondAttribute="bottom" constant="8" id="xG7-dV-2kA"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="IxU-Gn-Xag"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.17" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="c9o-SY-nTv">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.17" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="c9o-SY-nTv">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.14"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
|
|
@ -13,10 +14,6 @@
|
|||
<scene sceneID="c4d-Co-ZDg">
|
||||
<objects>
|
||||
<viewController id="c9o-SY-nTv" customClass="ViewController" customModule="ARTest" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="7yh-1L-coP"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="nug-AQ-Ian"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="1Bl-Sd-CgL">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
|
|
@ -53,20 +50,22 @@
|
|||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="Njh-xB-Eni" firstAttribute="leading" secondItem="1Bl-Sd-CgL" secondAttribute="leading" constant="8" id="2wP-ef-L3T"/>
|
||||
<constraint firstItem="dJt-7h-HKA" firstAttribute="leading" secondItem="1Bl-Sd-CgL" secondAttribute="leading" id="4bx-Tx-sPe"/>
|
||||
<constraint firstItem="Njh-xB-Eni" firstAttribute="leading" secondItem="IVz-9B-ZZ1" secondAttribute="leading" constant="8" id="2wP-ef-L3T"/>
|
||||
<constraint firstItem="dJt-7h-HKA" firstAttribute="leading" secondItem="IVz-9B-ZZ1" secondAttribute="leading" id="4bx-Tx-sPe"/>
|
||||
<constraint firstItem="A8H-27-gOc" firstAttribute="trailing" secondItem="1Bl-Sd-CgL" secondAttribute="trailingMargin" constant="8" id="5XV-Xz-6yD"/>
|
||||
<constraint firstItem="afd-Gw-4Rj" firstAttribute="centerX" secondItem="1Bl-Sd-CgL" secondAttribute="centerX" id="AfR-xh-8Y8"/>
|
||||
<constraint firstItem="nug-AQ-Ian" firstAttribute="top" secondItem="dJt-7h-HKA" secondAttribute="bottom" id="CAV-7O-bxx"/>
|
||||
<constraint firstItem="dJt-7h-HKA" firstAttribute="top" secondItem="IVz-9B-ZZ1" secondAttribute="top" id="8fJ-A0-nI5"/>
|
||||
<constraint firstItem="afd-Gw-4Rj" firstAttribute="centerX" secondItem="IVz-9B-ZZ1" secondAttribute="centerX" id="AfR-xh-8Y8"/>
|
||||
<constraint firstItem="dJt-7h-HKA" firstAttribute="bottom" secondItem="IVz-9B-ZZ1" secondAttribute="bottom" id="FJZ-KH-7L1"/>
|
||||
<constraint firstItem="afd-Gw-4Rj" firstAttribute="centerY" secondItem="1Bl-Sd-CgL" secondAttribute="centerY" id="HWi-y6-cjB"/>
|
||||
<constraint firstItem="dJt-7h-HKA" firstAttribute="top" secondItem="7yh-1L-coP" secondAttribute="bottom" id="KIN-nm-Epo"/>
|
||||
<constraint firstAttribute="trailing" secondItem="TIe-cZ-8FM" secondAttribute="trailing" id="PgX-AX-7DJ"/>
|
||||
<constraint firstItem="Njh-xB-Eni" firstAttribute="top" secondItem="7yh-1L-coP" secondAttribute="bottom" constant="8" id="PvX-S5-4JB"/>
|
||||
<constraint firstAttribute="trailing" secondItem="dJt-7h-HKA" secondAttribute="trailing" id="edJ-JQ-NAX"/>
|
||||
<constraint firstItem="TIe-cZ-8FM" firstAttribute="top" secondItem="7yh-1L-coP" secondAttribute="bottom" id="gm7-H4-RT2"/>
|
||||
<constraint firstItem="A8H-27-gOc" firstAttribute="top" secondItem="7yh-1L-coP" secondAttribute="bottom" constant="8" id="hCg-yz-J0r"/>
|
||||
<constraint firstItem="TIe-cZ-8FM" firstAttribute="leading" secondItem="1Bl-Sd-CgL" secondAttribute="leading" id="jGI-rc-aWt"/>
|
||||
<constraint firstItem="dJt-7h-HKA" firstAttribute="top" secondItem="IVz-9B-ZZ1" secondAttribute="top" id="KIN-nm-Epo"/>
|
||||
<constraint firstItem="IVz-9B-ZZ1" firstAttribute="trailing" secondItem="TIe-cZ-8FM" secondAttribute="trailing" id="PgX-AX-7DJ"/>
|
||||
<constraint firstItem="Njh-xB-Eni" firstAttribute="top" secondItem="IVz-9B-ZZ1" secondAttribute="top" constant="8" id="PvX-S5-4JB"/>
|
||||
<constraint firstItem="IVz-9B-ZZ1" firstAttribute="trailing" secondItem="dJt-7h-HKA" secondAttribute="trailing" id="edJ-JQ-NAX"/>
|
||||
<constraint firstItem="A8H-27-gOc" firstAttribute="top" secondItem="IVz-9B-ZZ1" secondAttribute="top" constant="8" id="hCg-yz-J0r"/>
|
||||
<constraint firstItem="TIe-cZ-8FM" firstAttribute="top" secondItem="IVz-9B-ZZ1" secondAttribute="top" id="ijq-JL-alF"/>
|
||||
<constraint firstItem="TIe-cZ-8FM" firstAttribute="leading" secondItem="IVz-9B-ZZ1" secondAttribute="leading" id="jGI-rc-aWt"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="IVz-9B-ZZ1"/>
|
||||
</view>
|
||||
<connections>
|
||||
<outlet property="prizelImageView" destination="afd-Gw-4Rj" id="f1F-B7-TSS"/>
|
||||
|
|
|
|||
|
|
@ -23,12 +23,22 @@
|
|||
import UIKit
|
||||
import SceneKit
|
||||
|
||||
class ARBullet: SCNNode {
|
||||
final class ARBullet: SCNNode {
|
||||
|
||||
private static let sphereRadius: CGFloat = 0.025
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
initialization()
|
||||
}
|
||||
|
||||
let arKitBox = SCNSphere(radius: 0.025)
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
initialization()
|
||||
}
|
||||
|
||||
private func initialization() {
|
||||
let arKitBox = SCNSphere(radius: ARBullet.sphereRadius)
|
||||
self.geometry = arKitBox
|
||||
let shape = SCNPhysicsShape(geometry: arKitBox, options: nil)
|
||||
self.physicsBody = SCNPhysicsBody(type: .dynamic, shape: shape)
|
||||
|
|
@ -43,8 +53,4 @@ class ARBullet: SCNNode {
|
|||
self.geometry?.materials = [material]
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,12 +23,25 @@
|
|||
import UIKit
|
||||
import SceneKit
|
||||
|
||||
class Logo: SCNNode {
|
||||
final class Logo: SCNNode {
|
||||
|
||||
private static let boxSide: CGFloat = 0.1
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
initialization()
|
||||
}
|
||||
|
||||
let logo = SCNBox(width: 0.1, height: 0.1, length: 0.1, chamferRadius: 0)
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
super.init(coder: aDecoder)
|
||||
initialization()
|
||||
}
|
||||
|
||||
private func initialization() {
|
||||
let logo = SCNBox(width: Logo.boxSide,
|
||||
height: Logo.boxSide,
|
||||
length: Logo.boxSide,
|
||||
chamferRadius: 0)
|
||||
self.geometry = logo
|
||||
let shape = SCNPhysicsShape(geometry: logo, options: nil)
|
||||
|
||||
|
|
@ -44,8 +57,4 @@ class Logo: SCNNode {
|
|||
self.geometry?.materials = [material, material, material, material, material, material]
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,21 +28,22 @@ private enum GameState {
|
|||
case shootting
|
||||
}
|
||||
|
||||
class ViewController: UIViewController, ARSCNViewDelegate {
|
||||
final class ViewController: UIViewController, ARSCNViewDelegate {
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
private static let logoMaxCount = 3
|
||||
private static let cameraToLogoSpace: Float = -1
|
||||
|
||||
// MARK: - IBOutlets
|
||||
|
||||
@IBOutlet weak var sceneView: ARSCNView!
|
||||
@IBOutlet weak var timeLabel: UILabel!
|
||||
@IBOutlet weak var scoreLabel: UILabel!
|
||||
@IBOutlet weak var prizelImageView: UIImageView!
|
||||
@IBOutlet private weak var sceneView: ARSCNView!
|
||||
@IBOutlet private weak var timeLabel: UILabel!
|
||||
@IBOutlet private weak var scoreLabel: UILabel!
|
||||
@IBOutlet private weak var prizelImageView: UIImageView!
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
|
||||
fileprivate var state: GameState = .placing {
|
||||
didSet {
|
||||
prizelImageView.isHidden = state == .placing
|
||||
|
|
@ -59,12 +60,12 @@ class ViewController: UIViewController, ARSCNViewDelegate {
|
|||
fileprivate var gameTimer: Timer?
|
||||
|
||||
// MARK: - ViewController life cycle
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
sceneView.scene.physicsWorld.contactDelegate = self
|
||||
|
||||
|
||||
// Show statistics such as fps and timing information
|
||||
sceneView.showsStatistics = true
|
||||
|
||||
|
|
@ -73,10 +74,10 @@ class ViewController: UIViewController, ARSCNViewDelegate {
|
|||
|
||||
logoCount = 0
|
||||
}
|
||||
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
|
||||
// Create a session configuration
|
||||
let configuration = ARSessionConfiguration.isSupported ? ARWorldTrackingSessionConfiguration()
|
||||
: ARSessionConfiguration()
|
||||
|
|
@ -84,19 +85,14 @@ class ViewController: UIViewController, ARSCNViewDelegate {
|
|||
// Run the view's session
|
||||
sceneView.session.run(configuration)
|
||||
}
|
||||
|
||||
|
||||
override func viewWillDisappear(_ animated: Bool) {
|
||||
super.viewWillDisappear(animated)
|
||||
|
||||
|
||||
// Pause the view's session
|
||||
sceneView.session.pause()
|
||||
stopGame()
|
||||
}
|
||||
|
||||
override func didReceiveMemoryWarning() {
|
||||
super.didReceiveMemoryWarning()
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
|
|
@ -118,7 +114,7 @@ class ViewController: UIViewController, ARSCNViewDelegate {
|
|||
sceneView.scene.rootNode.addChildNode(logo)
|
||||
|
||||
var translation = matrix_identity_float4x4
|
||||
translation.columns.3.z = -1
|
||||
translation.columns.3.z = ViewController.cameraToLogoSpace
|
||||
logo.simdTransform = matrix_multiply(currentFrame.camera.transform, translation)
|
||||
|
||||
logoCount += 1
|
||||
|
|
@ -168,12 +164,12 @@ extension ViewController {
|
|||
}
|
||||
|
||||
fileprivate func configureTimeLabel() {
|
||||
self.timeLabel.isHidden = self.gameSeconds == 0
|
||||
timeLabel.isHidden = self.gameSeconds == 0
|
||||
|
||||
let seconds = self.gameSeconds % 60
|
||||
let minutes = (self.gameSeconds / 60) % 60;
|
||||
let minutes = (self.gameSeconds / 60) % 60
|
||||
|
||||
self.timeLabel.text = String(format: "%02d:%02d", minutes, seconds)
|
||||
timeLabel.text = String(format: "%02d:%02d", minutes, seconds)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue