Everything working properly, only adjustments made. Reset scene mechanic implemented and working

This commit is contained in:
Nicklas 2024-03-14 16:25:47 +01:00
parent 5c75ae875e
commit ab6a148468
17 changed files with 1442 additions and 512 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
Assets/.DS_Store vendored

Binary file not shown.

Binary file not shown.

@ -55,10 +55,10 @@ void loop() {
//touchValue = touchRead(4); //touchValue = touchRead(4);
while (touchRead(4) < 30000) { while (touchRead(4) < 36000) {
Serial.println(touchRead(4)); Serial.println(touchRead(4));
delay(400); delay(400);
if (touchRead(4) >= 30000) { if (touchRead(4) >= 36000) {
Serial.println("Value above threshold"); Serial.println("Value above threshold");
rotateServo(); rotateServo();
@ -82,7 +82,7 @@ void rotateServo() {
for (int posDegrees = 0; posDegrees <= 180; posDegrees++) { for (int posDegrees = 0; posDegrees <= 180; posDegrees++) {
servo1.write(posDegrees); servo1.write(posDegrees);
delay(5); // Adjust the delay for smooth rotation delay(10); // Adjust the delay for smooth rotation
} }
for (int posDegrees = 180; posDegrees >= 0; posDegrees--) { for (int posDegrees = 180; posDegrees >= 0; posDegrees--) {

@ -146,7 +146,7 @@ public class BoundAirScript : MonoBehaviour
{ {
StartCoroutine(RemoveCollectedItem()); StartCoroutine(RemoveCollectedItem());
windObjectToCollect.SetActive(false); windObjectToCollect.SetActive(false);
boundControl.ReactivateBoundary(); //boundControl.ReactivateBoundary();
boundControl.RemoveBoundary("Air"); boundControl.RemoveBoundary("Air");
} }

@ -67,7 +67,7 @@ public class BoundEarthScript : MonoBehaviour
{ {
StartCoroutine(RemoveCollectedItem()); StartCoroutine(RemoveCollectedItem());
earthObjectToCollect.SetActive(false); earthObjectToCollect.SetActive(false);
boundControl.ReactivateBoundary(); //boundControl.ReactivateBoundary();
boundControl.RemoveBoundary("Earth"); boundControl.RemoveBoundary("Earth");
} }

@ -51,7 +51,7 @@ public class BoundFireScript : MonoBehaviour
public void CollectFireObject() public void CollectFireObject()
{ {
StartCoroutine(SecondNarrationAndObject()); StartCoroutine(SecondNarrationAndObject());
audioSource.PlayOneShot(narrationClipTwo); //audioSource.PlayOneShot(narrationClipTwo);
fireObjectToCollect.SetActive(true); fireObjectToCollect.SetActive(true);
} }
@ -74,7 +74,7 @@ public class BoundFireScript : MonoBehaviour
{ {
StartCoroutine(RemoveCollectedItem()); StartCoroutine(RemoveCollectedItem());
fireObjectToCollect.SetActive(false); fireObjectToCollect.SetActive(false);
boundControl.ReactivateBoundary(); //boundControl.ReactivateBoundary();
boundControl.RemoveBoundary("Fire"); boundControl.RemoveBoundary("Fire");
} }

@ -68,7 +68,7 @@ public class BoundWaterScript : MonoBehaviour
{ {
StartCoroutine(RemoveCollectedItem()); StartCoroutine(RemoveCollectedItem());
waterObjectToCollect.SetActive(false); waterObjectToCollect.SetActive(false);
boundControl.ReactivateBoundary(); //boundControl.ReactivateBoundary();
boundControl.RemoveBoundary("Water"); boundControl.RemoveBoundary("Water");
} }

@ -83,7 +83,8 @@ public class BoundaryControlScript : MonoBehaviour
{ {
airFinished = true; airFinished = true;
collectionCounter++; collectionCounter++;
PlayCollectionNarration(); //PlayCollectionNarration();
StartCoroutine(PlayCollectionNarration());
airHasBeenCollected = true; airHasBeenCollected = true;
airBoundary.SetActive(false); airBoundary.SetActive(false);
} }
@ -91,7 +92,9 @@ public class BoundaryControlScript : MonoBehaviour
{ {
earthFinished = true; earthFinished = true;
collectionCounter++; collectionCounter++;
PlayCollectionNarration(); //PlayCollectionNarration();
StartCoroutine(PlayCollectionNarration());
earthHasBeenCollected = true; earthHasBeenCollected = true;
earthBoundary.SetActive(false); earthBoundary.SetActive(false);
} }
@ -99,7 +102,9 @@ public class BoundaryControlScript : MonoBehaviour
{ {
waterFinished = true; waterFinished = true;
collectionCounter++; collectionCounter++;
PlayCollectionNarration(); //PlayCollectionNarration();
StartCoroutine(PlayCollectionNarration());
waterHasBeenCollected = true; waterHasBeenCollected = true;
waterBoundary.SetActive(false); waterBoundary.SetActive(false);
} }
@ -107,19 +112,24 @@ public class BoundaryControlScript : MonoBehaviour
{ {
fireFinished = true; fireFinished = true;
collectionCounter++; collectionCounter++;
PlayCollectionNarration(); //PlayCollectionNarration();
StartCoroutine(PlayCollectionNarration());
fireHasBeenCollected = true; fireHasBeenCollected = true;
fireBoundary.SetActive(false); fireBoundary.SetActive(false);
} }
} }
private void PlayCollectionNarration() IEnumerator PlayCollectionNarration()
{ {
if (collectionCounter > 0 && collectionCounter <= narrationClips.Length) if (collectionCounter > 0 && collectionCounter <= narrationClips.Length)
{ {
narrationSource.Stop(); narrationSource.Stop();
narrationSource.clip = narrationClips[collectionCounter - 1]; narrationSource.clip = narrationClips[collectionCounter - 1];
narrationSource.Play(); narrationSource.Play();
yield return new WaitForSeconds(narrationClips[collectionCounter - 1].length);
ReactivateBoundary();
} }
} }
//ADD functionality for detecting when all elements have been collected (eg when collectionCounter //ADD functionality for detecting when all elements have been collected (eg when collectionCounter

@ -64,7 +64,7 @@ public class ConnectUnityWithSensors : MonoBehaviour
if (forceDataReceived) if (forceDataReceived)
{ {
if (receivedForceValue > 900) if (receivedForceValue > 100)
{ {
Debug.Log("Force threshold exceeded, action triggered."); Debug.Log("Force threshold exceeded, action triggered.");
isForceDetected = true; isForceDetected = true;

@ -0,0 +1,30 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class RestartExperienceScript : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
public void OnTriggerEnter(Collider other)
{
if (other.CompareTag("BoundHMD"))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}
}

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9306a274e4e6645999f1109d1d59f44a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

@ -116,7 +116,7 @@ Material:
- _ZWrite: 1 - _ZWrite: 1
m_Colors: m_Colors:
- _BaseColor: {r: 0.17924526, g: 0.11463053, b: 0.026210394, a: 1} - _BaseColor: {r: 0.17924526, g: 0.11463053, b: 0.026210394, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 0.17924523, g: 0.1146305, b: 0.026210394, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1} - _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

@ -49,7 +49,7 @@ Material:
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MainTex: - _MainTex:
m_Texture: {fileID: 0} m_Texture: {fileID: 2800000, guid: 18fc5acde6bc24fcca8b7ac96b07b261, type: 3}
m_Scale: {x: 1, y: 1} m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0} m_Offset: {x: 0, y: 0}
- _MetallicGlossMap: - _MetallicGlossMap:

File diff suppressed because it is too large Load Diff