Air finished, earth narration working just connect with sensor that isnt able to test

This commit is contained in:
Nicklas 2024-03-04 18:57:23 +01:00
parent a0c2a60c30
commit 4d1dcaf1c4
15 changed files with 454 additions and 44 deletions

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 376eabe9157444434bd4edd15794eaf6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 54eb2b33988854e9bbeb3b21527d2f18
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 09a27277c062f490ea6f7f06842f100f
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 33724cce213214c3e8bba7e1c8b7f9de
AudioImporter:
externalObjects: {}
serializedVersion: 7
defaultSettings:
serializedVersion: 2
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
preloadAudioData: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

@ -6,18 +6,22 @@ public class BoundAirScript : MonoBehaviour
{
public ParticleSystem masterEmitter; // Assign in the inspector
public ParticleSystem slaveEmitter; // Assign in the inspector
public GameObject moreSpirals;
private float defaultLifetime = 0.5f; // Default start lifetime, adjust as needed
public float fasterLifetime = 2.0f; // Example faster lifetime, adjust as needed
public bool isWindActive = false;
private bool canActivateAir = false;
public bool canActivateAir = false;
public GameObject TestAir;
public bool narrationHasPlayed = false;
public AudioSource audioSource;
public AudioClip narrationClip;
public GameObject TestAir;
public GameObject BoundFire;
public GameObject BoundWater;
public GameObject BoundEarth;
// Start is called before the first frame update
void Start()
{
@ -30,43 +34,53 @@ public class BoundAirScript : MonoBehaviour
//Use Yield return to like not make it start instantly????
public void OnTriggerEnter(Collider other)
{
if (other.CompareTag("BoundHMD")) //
if (other.CompareTag("BoundHMD") && !isWindActive && !narrationHasPlayed) //
{
Debug.Log("Entered Earth");
Debug.Log("Entered Air");
TestAir.SetActive(true);
BoundEarth.SetActive(false);
BoundFire.SetActive(false);
BoundWater.SetActive(false);
narrationHasPlayed = true;
//Play narration and remove other temp
StartCoroutine(NarrationAndSignalCoroutine());
canActivateAir = true;
}
}
/*public void OnTriggerExit(Collider other)
public void OnTriggerExit(Collider other)
{
if (other.CompareTag("BoundHMD")) //
{
TestAir.SetActive(false);
}
}*/
}
IEnumerator NarrationAndSignalCoroutine()
{
audioSource.PlayOneShot(narrationClip);
yield return new WaitForSeconds(narrationClip.length);
canActivateAir = true;
}
public void AttemptActivatedAirEffect()
{
if (!isWindActive && canActivateAir)
{
AdjustParticleSpeed();
}
}
//Air effects
public void AdjustParticleSpeed()
{
if (!isWindActive && canActivateAir)
{
var masterMain = masterEmitter.main;
masterMain.startLifetime = fasterLifetime; // Adjust master emitter lifetime
@ -85,8 +99,7 @@ public class BoundAirScript : MonoBehaviour
isWindActive = true;
StartCoroutine(ResetParticleSpeed(5.0f)); // Assuming gesture lasts for * seconds
}
}
IEnumerator ResetParticleSpeed(float delay)
@ -115,8 +128,12 @@ public class BoundAirScript : MonoBehaviour
moreSpirals.SetActive(false);
isWindActive = false;
canActivateAir = false;
BoundEarth.SetActive(true);
BoundFire.SetActive(true);
BoundWater.SetActive(true);
//isWindActive = false;
//canActivateAir = false;
}

@ -4,29 +4,95 @@ using UnityEngine;
public class BoundEarthScript : MonoBehaviour
{
public bool narrationHasFinished = false;
public bool seedHasAppeared = false;
public bool narrationHasStarted = false;
public AudioSource audioSource;
public AudioClip narrationClip;
public AudioClip narrationClipTwo;
public GameObject seedObject;
public GameObject TestEarth;
public GameObject BoundFire;
public GameObject BoundWater;
public GameObject BoundAir;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
//Use Yield return to like not make it start instantly????
public void OnTriggerEnter(Collider other)
{
if (other.CompareTag("BoundHMD")) //
Debug.Log("Entered Earth");
TestEarth.SetActive(true);
if (other.CompareTag("BoundHMD") && !narrationHasFinished && !narrationHasStarted) //
{
Debug.Log("Entered Earth");
TestEarth.SetActive(true);
Debug.Log("Earth entered");
//Play narration and remove other temp
BoundAir.SetActive(false);
BoundFire.SetActive(false);
BoundWater.SetActive(false);
StartCoroutine(NarrationAndSignalCoroutine());
}
}
public void OnTriggerExit(Collider other)
{
if (other.CompareTag("BoundHMD")) //
{
TestEarth.SetActive(false);
}
}
IEnumerator NarrationAndSignalCoroutine()
{
narrationHasStarted = true;
audioSource.PlayOneShot(narrationClip);
yield return new WaitForSeconds(narrationClip.length);
narrationHasFinished = true;
}
public void collectForce() {
if (narrationHasFinished && !seedHasAppeared)
{
//Force sensor
// if (ConnectUnityWithSensors.isForceDetected)
// {
//}
seedObject.SetActive(true);
audioSource.PlayOneShot(narrationClipTwo);
seedHasAppeared = true;
BoundAir.SetActive(true);
BoundFire.SetActive(true);
BoundWater.SetActive(true);
}
}
}

@ -29,4 +29,12 @@ public class BoundFireScript : MonoBehaviour
}
}
public void OnTriggerExit(Collider other)
{
if (other.CompareTag("BoundHMD")) //
{
TestFire.SetActive(false);
}
}
}

@ -26,7 +26,14 @@ public class BoundWaterScript : MonoBehaviour
TestWater.SetActive(true);
//Play narration and remove other temp
}
}
public void OnTriggerExit(Collider other)
{
if (other.CompareTag("BoundHMD")) //
{
TestWater.SetActive(false);
}
}
}

@ -17,8 +17,13 @@ public class ConnectUnityWithSensors : MonoBehaviour
private bool forceDataReceived = false;
private int receivedForceValue = 0;
public static bool isForceDetected = false;
public BoundEarthScript earthScript = new BoundEarthScript();
void Start()
{
ConnectWithESP32();
}
@ -51,14 +56,25 @@ public class ConnectUnityWithSensors : MonoBehaviour
void Update()
{
if (forceDataReceived)
if (earthScript.narrationHasFinished && !earthScript.seedHasAppeared)
{
if (receivedForceValue > 50)
Debug.Log("Asking for force.");
ws.Send("Need Force");
if (forceDataReceived)
{
Debug.Log("Force threshold exceeded, action triggered.");
if (receivedForceValue > 40)
{
Debug.Log("Force threshold exceeded, action triggered.");
isForceDetected = true;
earthScript.collectForce();
}
forceDataReceived = false; // Reset for the next message
}
forceDataReceived = false; // Reset for the next message
}
}
void OnDestroy()
@ -68,4 +84,5 @@ public class ConnectUnityWithSensors : MonoBehaviour
ws.Close();
}
}
}

@ -22,7 +22,7 @@ public class GameManagerScript : MonoBehaviour
}
//Use Yield return to like not make it start instantly????
public void OnTriggerEnter(Collider other)
/*public void OnTriggerEnter(Collider other)
{
if (other.CompareTag("BoundEarth")) //
{
@ -48,5 +48,5 @@ public class GameManagerScript : MonoBehaviour
TestAir.SetActive(true);
//Play narration and remove otehr temp
}
}
}*/
}

@ -1468,6 +1468,7 @@ GameObject:
- component: {fileID: 171465763}
- component: {fileID: 171465762}
- component: {fileID: 171465761}
- component: {fileID: 171465764}
m_Layer: 0
m_Name: BoundriesHMD
m_TagString: BoundHMD
@ -1554,6 +1555,102 @@ BoxCollider:
serializedVersion: 3
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!82 &171465764
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 171465759}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
--- !u!1001 &173036998
PrefabInstance:
m_ObjectHideFlags: 0
@ -7403,9 +7500,14 @@ MonoBehaviour:
moreSpirals: {fileID: 1505324148}
fasterLifetime: 2
isWindActive: 0
canActivateAir: 0
narrationHasPlayed: 0
audioSource: {fileID: 171465764}
narrationClip: {fileID: 8300000, guid: 54eb2b33988854e9bbeb3b21527d2f18, type: 3}
TestAir: {fileID: 1458529866}
audioSource: {fileID: 579970260}
narrationClip: {fileID: 0}
BoundFire: {fileID: 634926185}
BoundWater: {fileID: 1726060519}
BoundEarth: {fileID: 1596973207}
--- !u!82 &579970260
AudioSource:
m_ObjectHideFlags: 0
@ -7413,11 +7515,11 @@ AudioSource:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 579970255}
m_Enabled: 1
m_Enabled: 0
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 0}
m_PlayOnAwake: 1
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
@ -11428,6 +11530,7 @@ Transform:
m_Children:
- {fileID: 1535956261}
- {fileID: 1596973208}
- {fileID: 1726452295}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &978370099
@ -11511,6 +11614,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
esp32IPAddress: 10.204.0.249
esp32WebsocketPort: 81
earthScript: {fileID: 1596973211}
--- !u!1001 &980743549
PrefabInstance:
m_ObjectHideFlags: 0
@ -15911,7 +16015,7 @@ AudioSource:
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: fa73defb6186473469383bd59ebadf53, type: 3}
m_PlayOnAwake: 1
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
@ -17044,7 +17148,7 @@ AudioSource:
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: 64eb66c3bae7a18418708a7acf215268, type: 3}
m_PlayOnAwake: 1
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
@ -19080,7 +19184,16 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: cc0e3798309a94a59a7f394d52b61915, type: 3}
m_Name:
m_EditorClassIdentifier:
narrationHasFinished: 0
seedHasAppeared: 0
audioSource: {fileID: 171465764}
narrationClip: {fileID: 8300000, guid: 09a27277c062f490ea6f7f06842f100f, type: 3}
narrationClipTwo: {fileID: 8300000, guid: 33724cce213214c3e8bba7e1c8b7f9de, type: 3}
seedObject: {fileID: 1726452294}
TestEarth: {fileID: 1019338306}
BoundFire: {fileID: 634926185}
BoundWater: {fileID: 1726060519}
BoundAir: {fileID: 579970255}
--- !u!1001 &1601739639
PrefabInstance:
m_ObjectHideFlags: 0
@ -19311,9 +19424,9 @@ MonoBehaviour:
_whenSelected:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 433101002}
m_TargetAssemblyTypeName: AirElementEffects, Assembly-CSharp
m_MethodName: AdjustParticleSpeed
- m_Target: {fileID: 579970259}
m_TargetAssemblyTypeName: BoundAirScript, Assembly-CSharp
m_MethodName: AttemptActivatedAirEffect
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
@ -20006,7 +20119,7 @@ AudioSource:
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: a7e7326748386054ba8842b6372a36eb, type: 3}
m_PlayOnAwake: 1
m_PlayOnAwake: 0
m_Volume: 1
m_Pitch: 1
Loop: 0
@ -21082,6 +21195,111 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
TestWater: {fileID: 707071907}
--- !u!1 &1726452294
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1726452295}
- component: {fileID: 1726452298}
- component: {fileID: 1726452297}
- component: {fileID: 1726452296}
m_Layer: 0
m_Name: SeedStandIn
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &1726452295
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1726452294}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 3.83, y: -2.212, z: -2.804}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 977726988}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!135 &1726452296
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1726452294}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 0
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Radius: 0.5
m_Center: {x: 0, y: 0, z: 0}
--- !u!23 &1726452297
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1726452294}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!33 &1726452298
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1726452294}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!1001 &1741286464
PrefabInstance:
m_ObjectHideFlags: 0

@ -28,6 +28,6 @@ MonoBehaviour:
EnableTrackingOriginStageMode: 0
SpaceWarp: 0
TargetQuest2: 1
TargetQuestPro: 0
TargetQuest3: 0
TargetQuestPro: 1
TargetQuest3: 1
SystemSplashScreen: {fileID: 0}