Pārlūkot izejas kodu

changing prefabs to groups; messing with camera lock on the targeted orbit camera

Justin Gilman 1 gadu atpakaļ
vecāks
revīzija
c455bd76a0

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Main.rogueScene


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/BarrelMovable.roguePrefab


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/CoinMovable.roguePrefab


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/DirtTile.roguePrefab


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/DoorMovable.roguePrefab


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/FloorRockyTile.roguePrefab


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/FloorTile.roguePrefab


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/Stairs.roguePrefab


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/TreasureChest.roguePrefab


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/WallHalfTile.roguePrefab


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
Assets/Prefabs/WallTile.roguePrefab


+ 16 - 10
Assets/rogue_packages/EyeOfMidas/targeted-orbit-camera/TargetedOrbitCamera.re.ts

@@ -22,7 +22,7 @@ export default class TargetedOrbitCamera extends RE.Component {
 	@RE.props.vector3() offset = new THREE.Vector3()
 	@RE.props.num() rotateMouseButton = 2
 
-	@RE.props.checkbox() useCameraLock = false
+	// @RE.props.checkbox() useCameraLock: boolean = false
 
 	rotateStart = new THREE.Vector2()
 	rotateEnd = new THREE.Vector2()
@@ -46,12 +46,11 @@ export default class TargetedOrbitCamera extends RE.Component {
 	
 
   awake() {
-	if(this.useCameraLock) {
-		const container = document.getElementById(RE.Runtime.containerId)
-		container?.addEventListener("mousedown", this.lock, false)
+	const container = document.getElementById(RE.Runtime.containerId)
+	container?.addEventListener("mousedown", this.lock, false)
+	container?.addEventListener("touchstart", this.lock, false)
 
-		RE.Runtime.onStop(this.dispose)
-	}
+	RE.Runtime.onStop(this.dispose)
   }
 
   start() {
@@ -75,8 +74,10 @@ export default class TargetedOrbitCamera extends RE.Component {
 	if(!this.target) {
 		return
 	}
+
+	const useCameraLock = true//this.useCameraLock
 	
-	if(this.useCameraLock && !!document.pointerLockElement) {	
+	if(useCameraLock && !!document.pointerLockElement) {	
 		if(this.enableRotate && RE.Input.mouse.isMoving) {	
 			let normalizedScreenMovement = new THREE.Vector2(0,0)
 			this.normalizeScreenMovement({x: RE.Input.mouse.movementX, y: RE.Input.mouse.movementY}, normalizedScreenMovement)
@@ -117,7 +118,7 @@ export default class TargetedOrbitCamera extends RE.Component {
 	
 
 
-	if(this.useCameraLock && RE.Input.keyboard.getKeyPressed("Escape")) {
+	if(useCameraLock && RE.Input.keyboard.getKeyPressed("Escape")) {
 		this.unlock()
 	}
 }
@@ -125,6 +126,7 @@ export default class TargetedOrbitCamera extends RE.Component {
 	dispose() {
 		const container = document.getElementById(RE.Runtime.containerId)
 		container?.removeEventListener("mousedown", this.lock, false)
+		container?.removeEventListener("touchstart", this.lock, false)
 	}
 
 	rotateLeft(angle) {
@@ -227,14 +229,18 @@ export default class TargetedOrbitCamera extends RE.Component {
   }
 
   lock() {
-	if(!this.useCameraLock) {
+	const useCameraLock = true//this.useCameraLock
+	console.log("attempting camera lock", useCameraLock)
+	if(!useCameraLock) {
 		return
 	}
+	console.log("locking camera")
 	RE.Input.mouse.lock()
   }
 
   unlock() {
-	if(!this.useCameraLock) {
+	const useCameraLock = true//this.useCameraLock
+	if(!useCameraLock) {
 		return
 	}
 	RE.Input.mouse.unlock()

+ 14 - 13
dist/rogue-engine-user-scripts.js

@@ -636,7 +636,6 @@ class TargetedOrbitCamera extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Comp
     this.maxDistance = 50;
     this.offset = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3();
     this.rotateMouseButton = 2;
-    this.useCameraLock = false;
     this.rotateStart = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2();
     this.rotateEnd = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2();
     this.rotateDelta = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2();
@@ -652,11 +651,10 @@ class TargetedOrbitCamera extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Comp
     this.initialOffset = new three__WEBPACK_IMPORTED_MODULE_1__.Vector3();
   }
   awake() {
-    if (this.useCameraLock) {
-      const container = document.getElementById(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.containerId);
-      container?.addEventListener("mousedown", this.lock, false);
-      rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.onStop(this.dispose);
-    }
+    const container = document.getElementById(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.containerId);
+    container?.addEventListener("mousedown", this.lock, false);
+    container?.addEventListener("touchstart", this.lock, false);
+    rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.onStop(this.dispose);
   }
   start() {
     if (!this.target) {
@@ -675,7 +673,8 @@ class TargetedOrbitCamera extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Comp
     if (!this.target) {
       return;
     }
-    if (this.useCameraLock && !!document.pointerLockElement) {
+    const useCameraLock = true;
+    if (useCameraLock && !!document.pointerLockElement) {
       if (this.enableRotate && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.isMoving) {
         let normalizedScreenMovement = new three__WEBPACK_IMPORTED_MODULE_1__.Vector2(0, 0);
         this.normalizeScreenMovement({ x: rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.movementX, y: rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.movementY }, normalizedScreenMovement);
@@ -703,13 +702,14 @@ class TargetedOrbitCamera extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Comp
       this.dollyIn();
     }
     this.updateCamera();
-    if (this.useCameraLock && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.keyboard.getKeyPressed("Escape")) {
+    if (useCameraLock && rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.keyboard.getKeyPressed("Escape")) {
       this.unlock();
     }
   }
   dispose() {
     const container = document.getElementById(rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Runtime.containerId);
     container?.removeEventListener("mousedown", this.lock, false);
+    container?.removeEventListener("touchstart", this.lock, false);
   }
   rotateLeft(angle) {
     this.sphericalDelta.theta -= angle;
@@ -773,13 +773,17 @@ class TargetedOrbitCamera extends rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Comp
     gameVector.y = -(browserVector.y / bounds.height);
   }
   lock() {
-    if (!this.useCameraLock) {
+    const useCameraLock = true;
+    console.log("attempting camera lock", useCameraLock);
+    if (!useCameraLock) {
       return;
     }
+    console.log("locking camera");
     rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.lock();
   }
   unlock() {
-    if (!this.useCameraLock) {
+    const useCameraLock = true;
+    if (!useCameraLock) {
       return;
     }
     rogue_engine__WEBPACK_IMPORTED_MODULE_0__.Input.mouse.unlock();
@@ -825,9 +829,6 @@ __decorateClass([
 __decorateClass([
   rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.num()
 ], TargetedOrbitCamera.prototype, "rotateMouseButton", 2);
-__decorateClass([
-  rogue_engine__WEBPACK_IMPORTED_MODULE_0__.props.checkbox()
-], TargetedOrbitCamera.prototype, "useCameraLock", 2);
 rogue_engine__WEBPACK_IMPORTED_MODULE_0__.registerComponent(TargetedOrbitCamera);
 
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/rogue-engine-user-scripts.js.map


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels