add proximity audio to school and park pond
This commit is contained in:
parent
8af0fc608d
commit
52abf0266d
6 changed files with 98 additions and 0 deletions
BIN
Game/Assets/Audio/campanile-79046.mp3
(Stored with Git LFS)
Normal file
BIN
Game/Assets/Audio/campanile-79046.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
23
Game/Assets/Audio/campanile-79046.mp3.meta
Normal file
23
Game/Assets/Audio/campanile-79046.mp3.meta
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 87f42ddfbd6ec30469ddd6094df7bb12
|
||||||
|
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:
|
BIN
Game/Assets/Audio/running-stream-water-sound-239612.mp3
(Stored with Git LFS)
Normal file
BIN
Game/Assets/Audio/running-stream-water-sound-239612.mp3
(Stored with Git LFS)
Normal file
Binary file not shown.
23
Game/Assets/Audio/running-stream-water-sound-239612.mp3.meta
Normal file
23
Game/Assets/Audio/running-stream-water-sound-239612.mp3.meta
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 40b73b23adcb26b468a34ef55de6968d
|
||||||
|
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:
|
35
Game/Assets/AudioLoop.cs
Normal file
35
Game/Assets/AudioLoop.cs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
Author : Wai Lam
|
||||||
|
Date : 10/2/2025
|
||||||
|
Description : Loop the school bell and interval
|
||||||
|
*/
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class AudioLoop : MonoBehaviour
|
||||||
|
{
|
||||||
|
public AudioSource audioSource; // Attach your AudioSource in the Inspector
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
if (audioSource == null)
|
||||||
|
{
|
||||||
|
audioSource = GetComponent<AudioSource>();
|
||||||
|
}
|
||||||
|
StartCoroutine(PlayPauseLoop());
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator PlayPauseLoop()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
audioSource.Stop();
|
||||||
|
audioSource.Play(); // Play the audio
|
||||||
|
yield return new WaitForSeconds(10f); // Play for 10 seconds
|
||||||
|
|
||||||
|
audioSource.Stop(); // Pause the audio
|
||||||
|
yield return new WaitForSeconds(15f); // Pause for 15 seconds
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Game/Assets/AudioLoop.cs.meta
Normal file
11
Game/Assets/AudioLoop.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 97af51c0bb51c334fad1e4981ddb0749
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Add table
Reference in a new issue