diff --git a/3d-generation-pipeline/generate_voiceline_amplitude_curves.py b/3d-generation-pipeline/generate_voiceline_amplitude_curves.py new file mode 100644 index 00000000..892fd0a6 --- /dev/null +++ b/3d-generation-pipeline/generate_voiceline_amplitude_curves.py @@ -0,0 +1,52 @@ +import os +import librosa +import numpy as np + +# === CONFIG === +FRAME_DURATION = 0.02 # 20 ms windows +GAIN = 1.0 # multiply RMS values (set to e.g. 30.0 if you want larger values) +EXTENSION = ".txt" # output file extension + + +def process_wav(filepath): + print(f"Processing: {filepath}") + + # Load audio + audio, sr = librosa.load(filepath, mono=True) + + # Frame size in samples + frame_len = int(FRAME_DURATION * sr) + hop_len = frame_len + + # Compute RMS + rms = librosa.feature.rms( + y=audio, + frame_length=frame_len, + hop_length=hop_len + )[0] + + # Apply optional gain + rms = rms * GAIN + + # Save to .txt + out_path = os.path.splitext(filepath)[0] + EXTENSION + np.savetxt(out_path, rms, fmt="%.8f") + + print(f"Saved RMS → {out_path}") + + +def process_folder(folder_path): + print(f"Scanning folder: {folder_path}") + + for filename in os.listdir(folder_path): + if filename.lower().endswith(".wav"): + filepath = os.path.join(folder_path, filename) + process_wav(filepath) + + print("Done!") + + +# === Run script === +if __name__ == "__main__": + folder = input("Enter folder path: ").strip() + process_folder(folder) \ No newline at end of file diff --git a/3d-generation-pipeline/line_rms.txt b/3d-generation-pipeline/line_rms.txt new file mode 100644 index 00000000..e6cddc51 --- /dev/null +++ b/3d-generation-pipeline/line_rms.txt @@ -0,0 +1,49 @@ +3.170447962475009263e-05 +2.923115389421582222e-04 +2.510738931596279144e-02 +1.111792679876089096e-02 +6.692767888307571411e-02 +1.006313711404800415e-01 +7.780694961547851562e-02 +5.686730891466140747e-02 +5.614304915070533752e-02 +4.554714635014533997e-02 +4.514135792851448059e-02 +5.479728057980537415e-02 +4.272024706006050110e-02 +3.989587724208831787e-02 +4.298635944724082947e-02 +4.074911773204803467e-02 +2.244980260729789734e-02 +1.105279754847288132e-02 +1.347438804805278778e-02 +1.654553040862083435e-02 +1.846965588629245758e-02 +2.045047841966152191e-02 +1.407719496637582779e-02 +6.578906439244747162e-03 +1.353173051029443741e-02 +1.625132374465465546e-02 +5.863697826862335205e-02 +1.110599413514137268e-01 +9.950184077024459839e-02 +1.184522062540054321e-01 +1.000181213021278381e-01 +6.772108376026153564e-02 +7.621638476848602295e-02 +3.018615581095218658e-02 +9.624224901199340820e-02 +1.259753555059432983e-01 +1.276500672101974487e-01 +1.206035763025283813e-01 +1.011835709214210510e-01 +6.155343726277351379e-02 +3.734333068132400513e-02 +2.485111355781555176e-02 +2.122259326279163361e-02 +1.139380130916833878e-02 +7.472451310604810715e-03 +5.807624198496341705e-03 +1.960268709808588028e-03 +8.761089411564171314e-04 +3.071058890782296658e-04 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Coming.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Coming.txt new file mode 100644 index 00000000..650cc732 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Coming.txt @@ -0,0 +1,49 @@ +0.00003170 +0.00029231 +0.02510739 +0.01111793 +0.06692768 +0.10063137 +0.07780695 +0.05686731 +0.05614305 +0.04554715 +0.04514136 +0.05479728 +0.04272025 +0.03989588 +0.04298636 +0.04074912 +0.02244980 +0.01105280 +0.01347439 +0.01654553 +0.01846966 +0.02045048 +0.01407719 +0.00657891 +0.01353173 +0.01625132 +0.05863698 +0.11105994 +0.09950184 +0.11845221 +0.10001812 +0.06772108 +0.07621638 +0.03018616 +0.09624225 +0.12597536 +0.12765007 +0.12060358 +0.10118357 +0.06155344 +0.03734333 +0.02485111 +0.02122259 +0.01139380 +0.00747245 +0.00580762 +0.00196027 +0.00087611 +0.00030711 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Coming.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Coming.txt.meta new file mode 100644 index 00000000..ea98b6a1 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Coming.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 84e297664a2336d43820a26e20887968 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Enjoy.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Enjoy.txt new file mode 100644 index 00000000..a7f9e9ed --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Enjoy.txt @@ -0,0 +1,29 @@ +0.00004669 +0.00196096 +0.08631672 +0.10883392 +0.10372495 +0.06708473 +0.07460631 +0.08464301 +0.06364747 +0.05883840 +0.05702791 +0.10027512 +0.10192653 +0.10898386 +0.10629675 +0.10652895 +0.08811360 +0.08259293 +0.07683600 +0.07712611 +0.05985371 +0.03709152 +0.02102884 +0.02044402 +0.01440325 +0.00486909 +0.00437166 +0.00128601 +0.00015899 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Enjoy.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Enjoy.txt.meta new file mode 100644 index 00000000..8da17028 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Enjoy.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ba1a609db49973948b295539bf908b8f +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Excellent.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Excellent.txt new file mode 100644 index 00000000..8d940e81 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Excellent.txt @@ -0,0 +1,53 @@ +0.00000003 +0.00003020 +0.00045428 +0.07712748 +0.11033373 +0.11507816 +0.09579168 +0.05667291 +0.03575071 +0.02704627 +0.03697587 +0.03463140 +0.03093839 +0.02743065 +0.02676925 +0.02231544 +0.09942202 +0.08020217 +0.06853641 +0.09176871 +0.09486435 +0.08342584 +0.07102263 +0.06072441 +0.06089513 +0.05636132 +0.03297666 +0.02339198 +0.03075436 +0.05637543 +0.06598097 +0.02687529 +0.07031629 +0.09098011 +0.08283509 +0.05433415 +0.06212619 +0.05257111 +0.03363059 +0.02073754 +0.01075210 +0.01171772 +0.01217843 +0.01418561 +0.01133840 +0.01065959 +0.01273228 +0.01126342 +0.00568159 +0.00296962 +0.00118520 +0.00046806 +0.00016418 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Excellent.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Excellent.txt.meta new file mode 100644 index 00000000..fc132810 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Excellent.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ec6f9f3ba83eb534594c69058496c8d5 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Get_Correctly.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Get_Correctly.txt new file mode 100644 index 00000000..c796a9f6 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Get_Correctly.txt @@ -0,0 +1,57 @@ +0.00254833 +0.02971284 +0.08879764 +0.07367895 +0.02909987 +0.03310917 +0.09634954 +0.12386660 +0.09035879 +0.09341748 +0.07560141 +0.03713432 +0.02660947 +0.05858222 +0.11556806 +0.09857281 +0.08213513 +0.05986574 +0.03114414 +0.11308713 +0.11102232 +0.06087070 +0.02572891 +0.01722053 +0.02621842 +0.02313918 +0.01146464 +0.01218087 +0.04863987 +0.05884862 +0.05150265 +0.07699542 +0.12463907 +0.09878866 +0.09524542 +0.04189667 +0.02693668 +0.03294044 +0.01990215 +0.01164732 +0.02052239 +0.04459940 +0.07784607 +0.08742625 +0.07854719 +0.09712429 +0.11146211 +0.08322848 +0.04158131 +0.02026966 +0.01889879 +0.01323800 +0.01184629 +0.00824499 +0.00307148 +0.00118924 +0.00017368 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Get_Correctly.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Get_Correctly.txt.meta new file mode 100644 index 00000000..ccd2c515 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Get_Correctly.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c83fbb76e4a0a39498f067a92c03c5e9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is1.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is1.txt new file mode 100644 index 00000000..081d7b07 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is1.txt @@ -0,0 +1,30 @@ +0.00295235 +0.03707517 +0.07725370 +0.07228835 +0.09575068 +0.08504528 +0.10041153 +0.11009778 +0.11758450 +0.09146283 +0.03880034 +0.03676090 +0.09672804 +0.09430671 +0.08924873 +0.08860046 +0.06662061 +0.05558098 +0.04712987 +0.03207022 +0.02364047 +0.01690631 +0.01206164 +0.01287380 +0.01311070 +0.01108581 +0.00924442 +0.00443145 +0.00183625 +0.00034499 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is1.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is1.txt.meta new file mode 100644 index 00000000..b965fdb9 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is1.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c5ea2bb1417b52b44b2d5e3044a21696 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is2.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is2.txt new file mode 100644 index 00000000..546c94ce --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is2.txt @@ -0,0 +1,33 @@ +0.00012380 +0.00102616 +0.00415505 +0.05197068 +0.09016228 +0.10255087 +0.11967184 +0.09882818 +0.10230196 +0.09351663 +0.08933863 +0.09581169 +0.05233340 +0.03342716 +0.05679970 +0.10582927 +0.10664634 +0.09213629 +0.08116415 +0.06822676 +0.05873912 +0.05475385 +0.03594853 +0.02781619 +0.02577862 +0.02322852 +0.01829937 +0.01572386 +0.01399139 +0.00680759 +0.00405515 +0.00090124 +0.00012206 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is2.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is2.txt.meta new file mode 100644 index 00000000..f0211680 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_It_Is2.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 347034c0a27f0934d8304f45514b7c92 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_You_Go.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_You_Go.txt new file mode 100644 index 00000000..52c41d01 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_You_Go.txt @@ -0,0 +1,37 @@ +0.00001716 +0.00034244 +0.00115882 +0.00576633 +0.07651001 +0.10384929 +0.11343405 +0.09679694 +0.08230647 +0.08237075 +0.05789162 +0.06589982 +0.07386018 +0.08840372 +0.07979485 +0.05375632 +0.03967692 +0.03100157 +0.06183979 +0.13154010 +0.12473223 +0.09088991 +0.10479537 +0.09337825 +0.09433472 +0.09392123 +0.09064700 +0.05741799 +0.03410449 +0.02425617 +0.03073216 +0.02371081 +0.00905390 +0.00480045 +0.00522001 +0.00273450 +0.00044766 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_You_Go.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_You_Go.txt.meta new file mode 100644 index 00000000..eada01f8 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Here_You_Go.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 63b1e546bf387534a9c8f9c272c34058 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Is_Correct.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Is_Correct.txt new file mode 100644 index 00000000..f6edbf01 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Is_Correct.txt @@ -0,0 +1,46 @@ +0.02050972 +0.10168069 +0.11275169 +0.11559874 +0.05694683 +0.04488800 +0.03916322 +0.03770525 +0.03320975 +0.01921837 +0.00880236 +0.00834341 +0.02505843 +0.12048865 +0.12807892 +0.10973666 +0.06822228 +0.04750294 +0.03394053 +0.02910510 +0.03405723 +0.02068192 +0.00726618 +0.00403132 +0.00408158 +0.00396793 +0.01481405 +0.07425826 +0.08119930 +0.05466220 +0.07122602 +0.13017716 +0.17926741 +0.10760592 +0.11298829 +0.07887404 +0.04382631 +0.02363179 +0.02069380 +0.01384185 +0.00531502 +0.00320957 +0.00754439 +0.00492329 +0.00180884 +0.00040035 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Is_Correct.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Is_Correct.txt.meta new file mode 100644 index 00000000..d8b4ce65 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Is_Correct.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 3befa8f8796fba842a8b81b3092b296e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Moment.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Moment.txt new file mode 100644 index 00000000..6ec1ffd3 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Moment.txt @@ -0,0 +1,39 @@ +0.00680616 +0.02000667 +0.03981570 +0.07353978 +0.15890054 +0.15065886 +0.12441381 +0.05674819 +0.03283060 +0.02227908 +0.02677164 +0.02564943 +0.01810250 +0.00562337 +0.00632352 +0.00499442 +0.03332803 +0.12671307 +0.12913454 +0.07289811 +0.06429900 +0.05912491 +0.07001997 +0.08970365 +0.14829005 +0.12578993 +0.06392633 +0.06561711 +0.06369394 +0.06709526 +0.08250566 +0.07605470 +0.05834744 +0.04749091 +0.04297124 +0.02600872 +0.00910767 +0.00459244 +0.00196225 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Moment.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Moment.txt.meta new file mode 100644 index 00000000..150f22bf --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Moment.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bb315b5169b9b7341a7d9af5fd865879 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order.txt new file mode 100644 index 00000000..ec4ebdea --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order.txt @@ -0,0 +1,96 @@ +0.00014598 +0.02786572 +0.11496738 +0.10238128 +0.07388683 +0.06242444 +0.10997712 +0.13044015 +0.14964159 +0.11141456 +0.10278545 +0.11485842 +0.11351028 +0.10489768 +0.08198220 +0.07194153 +0.05434150 +0.03275726 +0.03367535 +0.02172300 +0.00987169 +0.00986360 +0.00508794 +0.00191669 +0.00047967 +0.00000670 +0.00000018 +0.00000015 +0.00000015 +0.00000015 +0.00000016 +0.00000017 +0.00000017 +0.00000018 +0.00000020 +0.00000021 +0.00000007 +0.00000022 +0.00000006 +0.00000022 +0.00060145 +0.00808220 +0.03894912 +0.12594621 +0.13255514 +0.10433636 +0.08640841 +0.04327250 +0.03839190 +0.03875956 +0.05473800 +0.11749637 +0.13128278 +0.10626067 +0.04351380 +0.04390190 +0.03948491 +0.03793582 +0.09538835 +0.11432847 +0.10463299 +0.09305388 +0.09277155 +0.07825337 +0.09924649 +0.08766949 +0.05093555 +0.02933786 +0.03307276 +0.02032575 +0.01915358 +0.02244372 +0.05538168 +0.09692254 +0.11038408 +0.05580291 +0.05752378 +0.12149326 +0.10537492 +0.09177154 +0.08779024 +0.05957314 +0.07311515 +0.10100933 +0.08425441 +0.06698531 +0.07025033 +0.06641871 +0.03747740 +0.01966268 +0.01292341 +0.00592666 +0.00414338 +0.00207189 +0.00059345 +0.00011407 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order.txt.meta new file mode 100644 index 00000000..973a09af --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a0865f784bc609c44921a10c05847f1e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Is_Ready.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Is_Ready.txt new file mode 100644 index 00000000..8f32d2b1 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Is_Ready.txt @@ -0,0 +1,53 @@ +0.00000003 +0.00000001 +0.00000000 +0.00006617 +0.00825588 +0.05550662 +0.06659701 +0.06921944 +0.08179279 +0.09857339 +0.08639858 +0.07547399 +0.05148134 +0.01930095 +0.01384417 +0.01106333 +0.05356188 +0.12289032 +0.12155826 +0.12509871 +0.10730626 +0.05343417 +0.10618726 +0.10502439 +0.09942293 +0.09280483 +0.08935775 +0.06305087 +0.06458813 +0.03893311 +0.07498286 +0.11144519 +0.08733452 +0.05019294 +0.04413920 +0.04448941 +0.02578673 +0.02903163 +0.02947936 +0.06914449 +0.10478083 +0.09993452 +0.08101768 +0.03436182 +0.02376112 +0.01966190 +0.03744587 +0.03780399 +0.02365103 +0.02165905 +0.01133459 +0.00479161 +0.00240724 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Is_Ready.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Is_Ready.txt.meta new file mode 100644 index 00000000..3ba49a8e --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Is_Ready.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ed55b6762e61b9349950fbe3650cabf6 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Repeat.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Repeat.txt new file mode 100644 index 00000000..6711b49c --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Repeat.txt @@ -0,0 +1,139 @@ +0.00000003 +0.00000002 +0.00000897 +0.00051868 +0.00685851 +0.00242072 +0.07569526 +0.13911512 +0.12309561 +0.12859440 +0.09661367 +0.11087048 +0.10346829 +0.10614007 +0.09598915 +0.08047114 +0.09286903 +0.11548064 +0.11452914 +0.10821884 +0.08427280 +0.05659365 +0.05306242 +0.03046137 +0.02309663 +0.01407314 +0.00619217 +0.00181442 +0.00025129 +0.00004446 +0.00000027 +0.00000024 +0.00000026 +0.00000023 +0.00000025 +0.00058232 +0.01438166 +0.08706226 +0.05324214 +0.04622319 +0.03107418 +0.02088210 +0.08227722 +0.12894586 +0.12848234 +0.11699706 +0.10615379 +0.05741793 +0.06020827 +0.06396029 +0.06524623 +0.04965931 +0.05436188 +0.03945747 +0.05630253 +0.10608354 +0.09860967 +0.07679673 +0.07259783 +0.08343784 +0.09909578 +0.09040866 +0.04385882 +0.03242830 +0.03005066 +0.02469170 +0.02442984 +0.02259176 +0.01854928 +0.01633028 +0.00924866 +0.00342354 +0.00093352 +0.00019096 +0.00003074 +0.00000033 +0.00000035 +0.00000035 +0.00000035 +0.00000028 +0.00054907 +0.02254597 +0.01685557 +0.03537999 +0.06535218 +0.08047795 +0.09143815 +0.10887608 +0.09207053 +0.07770705 +0.05117515 +0.04016748 +0.04277807 +0.03733924 +0.01808697 +0.05714072 +0.13481680 +0.12341464 +0.04113217 +0.04200054 +0.03387635 +0.02640645 +0.03010297 +0.06187404 +0.07365302 +0.07283713 +0.03723831 +0.02066344 +0.01486296 +0.02139168 +0.01329754 +0.03340966 +0.09857203 +0.10937501 +0.07175481 +0.09430910 +0.10526963 +0.10333330 +0.08292542 +0.10443841 +0.10521737 +0.10867214 +0.10509364 +0.04809517 +0.07553424 +0.15021303 +0.09417224 +0.10969985 +0.08089382 +0.04732396 +0.03919236 +0.02811258 +0.01335024 +0.00913966 +0.00645466 +0.00518705 +0.00219298 +0.00128141 +0.00048321 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Repeat.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Repeat.txt.meta new file mode 100644 index 00000000..d58d69ce --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Order_Repeat.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 6a149965eba498242a3ec5a6c865900e +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Ready_In.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Ready_In.txt new file mode 100644 index 00000000..668e52e0 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Ready_In.txt @@ -0,0 +1,72 @@ +0.00000003 +0.00000002 +0.00000000 +0.00000000 +0.00001562 +0.00183886 +0.01718909 +0.08121856 +0.05650272 +0.04327853 +0.04348287 +0.04189854 +0.04546760 +0.06406592 +0.11061928 +0.10493957 +0.11083768 +0.06164746 +0.03147869 +0.03161191 +0.03992244 +0.06945074 +0.08005552 +0.07761027 +0.06662179 +0.04597136 +0.07420090 +0.11428896 +0.10177862 +0.12583645 +0.10110252 +0.06948989 +0.04131342 +0.04411544 +0.06125725 +0.06420285 +0.07109744 +0.08405773 +0.04717634 +0.05160779 +0.04885459 +0.02962608 +0.03509536 +0.02471529 +0.06745352 +0.11273529 +0.10746661 +0.07098871 +0.06722593 +0.06514815 +0.08039723 +0.05482315 +0.06228336 +0.04914901 +0.07718404 +0.10486372 +0.10146042 +0.10682139 +0.08627858 +0.06619428 +0.05619252 +0.05044676 +0.04965245 +0.04330982 +0.02298543 +0.01822150 +0.01050079 +0.00632150 +0.00265475 +0.00078896 +0.00008045 +0.00002478 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Ready_In.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Ready_In.txt.meta new file mode 100644 index 00000000..4a996f52 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Ready_In.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1db4c8a48390808499d0fb84e1bb0be3 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Serve.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Serve.txt new file mode 100644 index 00000000..b6d64352 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Serve.txt @@ -0,0 +1,72 @@ +0.00075272 +0.00794692 +0.01698765 +0.13918686 +0.11231101 +0.11741962 +0.12016004 +0.09403438 +0.08492339 +0.07881802 +0.06068442 +0.05910769 +0.05156586 +0.03752719 +0.01887535 +0.01161673 +0.00691089 +0.00435083 +0.00179454 +0.00088135 +0.00022185 +0.00001349 +0.00000020 +0.00000018 +0.00000017 +0.00000016 +0.00055471 +0.06944270 +0.11770695 +0.12539980 +0.09475044 +0.04003724 +0.03506203 +0.02060395 +0.02197486 +0.02215128 +0.07995977 +0.11134646 +0.08804584 +0.05062433 +0.09141289 +0.10671950 +0.10737142 +0.10278893 +0.03680010 +0.05165839 +0.03910501 +0.03037758 +0.03522700 +0.02177294 +0.08287371 +0.11302635 +0.09611569 +0.10870011 +0.11076381 +0.05023886 +0.04335597 +0.02533474 +0.02797309 +0.03084667 +0.04804834 +0.05148838 +0.06445197 +0.06046679 +0.05829129 +0.04899684 +0.01466017 +0.00853707 +0.00619025 +0.00404124 +0.00321156 +0.00103366 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Serve.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Serve.txt.meta new file mode 100644 index 00000000..e065a56b --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Serve.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 56d4ae4fc1290ea46b255afbcdfbdcd4 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_1.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_1.txt new file mode 100644 index 00000000..e0731d13 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_1.txt @@ -0,0 +1,160 @@ +0.00029612 +0.05576286 +0.12553830 +0.13002180 +0.12268352 +0.11259939 +0.11263055 +0.11280974 +0.11363940 +0.10217790 +0.06738460 +0.07115833 +0.03878124 +0.03537671 +0.01826828 +0.00843036 +0.00465221 +0.00144809 +0.00040472 +0.00000262 +0.00000021 +0.00000021 +0.00000020 +0.00000021 +0.00000022 +0.00000021 +0.00000020 +0.00000021 +0.00005819 +0.00248238 +0.00860332 +0.04936272 +0.07930961 +0.08939290 +0.07552250 +0.05030897 +0.03739030 +0.04243989 +0.02067272 +0.04019468 +0.02969449 +0.02286482 +0.06015887 +0.09926614 +0.12978534 +0.11802185 +0.11661354 +0.12958084 +0.13646013 +0.12383421 +0.11965226 +0.13084649 +0.09151545 +0.06099255 +0.05139248 +0.03909664 +0.04320430 +0.06831136 +0.05426402 +0.09439751 +0.08630691 +0.05404758 +0.03027208 +0.02376678 +0.01914030 +0.01846080 +0.02368451 +0.01983017 +0.06582387 +0.06231020 +0.06126793 +0.04846942 +0.03552648 +0.03728516 +0.04440843 +0.02177399 +0.01871013 +0.02152575 +0.01540541 +0.00577175 +0.00218781 +0.00023569 +0.00001835 +0.00000365 +0.00000023 +0.00000026 +0.00000023 +0.00000022 +0.00000022 +0.00000022 +0.00000021 +0.00000022 +0.00001183 +0.00016163 +0.00536046 +0.09190191 +0.11561806 +0.09210216 +0.06860127 +0.06077314 +0.06870884 +0.08130348 +0.08941159 +0.07111050 +0.02582909 +0.02657495 +0.01097667 +0.01661127 +0.03420246 +0.06960077 +0.07701012 +0.06163447 +0.05414457 +0.06504545 +0.07106480 +0.06195536 +0.07285102 +0.04403912 +0.02910847 +0.01992947 +0.01365353 +0.03207099 +0.10715325 +0.10479537 +0.11186744 +0.03465843 +0.02840112 +0.02826291 +0.07848913 +0.07562794 +0.06734375 +0.04931764 +0.05265285 +0.03169486 +0.01847721 +0.02102288 +0.07058485 +0.10937411 +0.12513542 +0.09252730 +0.07330564 +0.07361754 +0.07101654 +0.10241644 +0.12694693 +0.13694772 +0.10874899 +0.04031714 +0.08964376 +0.12782487 +0.08065764 +0.08638465 +0.07355540 +0.05367583 +0.03047141 +0.01794434 +0.00735973 +0.00670951 +0.00250434 +0.00045465 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_1.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_1.txt.meta new file mode 100644 index 00000000..ee7778c6 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_1.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 2b952c32041fd334b845984e24164a5d +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_2.txt b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_2.txt new file mode 100644 index 00000000..e47b33d5 --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_2.txt @@ -0,0 +1,169 @@ +0.00000003 +0.00000002 +0.00000000 +0.00004383 +0.01040028 +0.07134394 +0.11974469 +0.10908774 +0.10968097 +0.10859580 +0.10317566 +0.09806535 +0.09371358 +0.08331236 +0.09894990 +0.09743189 +0.08950789 +0.07399292 +0.05284246 +0.02950291 +0.02860929 +0.01256964 +0.00841063 +0.00496687 +0.00220403 +0.00101902 +0.00046462 +0.00030938 +0.00007991 +0.00000272 +0.00000054 +0.00006914 +0.00067573 +0.01482361 +0.08421039 +0.11665606 +0.09523035 +0.08505520 +0.06534810 +0.06916682 +0.07089982 +0.06479634 +0.03923921 +0.02682951 +0.01650952 +0.02585265 +0.02846025 +0.02344972 +0.02559594 +0.06119725 +0.09374655 +0.09619626 +0.09788170 +0.08457492 +0.11381356 +0.08281529 +0.08347271 +0.04299688 +0.04031365 +0.06129927 +0.07096618 +0.07575628 +0.08945262 +0.09562955 +0.05157590 +0.03231056 +0.03043411 +0.02763353 +0.02144005 +0.02098208 +0.01770406 +0.05417547 +0.08799334 +0.07299370 +0.06113655 +0.04867299 +0.05348379 +0.04699092 +0.06081074 +0.04436160 +0.01624888 +0.02745478 +0.02184367 +0.01009084 +0.00326593 +0.00083276 +0.00020189 +0.00005908 +0.00000021 +0.00000017 +0.00000022 +0.00000017 +0.00000017 +0.00000010 +0.00000017 +0.00000010 +0.00000004 +0.00000004 +0.00000080 +0.00026455 +0.00660054 +0.00576026 +0.03566791 +0.08951622 +0.06892478 +0.08626635 +0.07530490 +0.07814025 +0.07977021 +0.05348110 +0.03681820 +0.01978932 +0.01448565 +0.01212297 +0.01791321 +0.07080884 +0.08582794 +0.07225253 +0.08081874 +0.08038840 +0.07051125 +0.04779942 +0.04367479 +0.03086200 +0.02376086 +0.02919743 +0.07812396 +0.07274966 +0.08457140 +0.07025231 +0.03704926 +0.02042784 +0.01561773 +0.01994788 +0.03676632 +0.06745287 +0.07491019 +0.03932576 +0.03251431 +0.01818534 +0.01368747 +0.01609767 +0.06141699 +0.10461546 +0.09720138 +0.10473271 +0.08458182 +0.06686288 +0.09136117 +0.09093073 +0.14752622 +0.12894824 +0.07711869 +0.08685626 +0.04436392 +0.07044879 +0.08246539 +0.10573285 +0.06203239 +0.07182535 +0.08256043 +0.05619702 +0.02425257 +0.01499773 +0.01143276 +0.00654857 +0.00445402 +0.00246197 +0.00038354 diff --git a/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_2.txt.meta b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_2.txt.meta new file mode 100644 index 00000000..6430813b --- /dev/null +++ b/Assets/StreamingAssets/CharacterVoicelines/Chef/Ulrich_Terribly_Sorry_2.txt.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c8c080425096f0841a43aa726b93d55a +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/AlienNPC.prefab b/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/ArcheryRangeNPC.prefab similarity index 95% rename from Assets/_PROJECT/Prefabs/ModelGeneration/Characters/AlienNPC.prefab rename to Assets/_PROJECT/Prefabs/ModelGeneration/Characters/ArcheryRangeNPC.prefab index 561b4a6d..04daaa9e 100644 --- a/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/AlienNPC.prefab +++ b/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/ArcheryRangeNPC.prefab @@ -91,12 +91,11 @@ GameObject: - component: {fileID: 6105090838799004608} - component: {fileID: 5789790698403274331} - component: {fileID: 7699707098595015193} - - component: {fileID: 1155083335105893391} - component: {fileID: 7315184541177211783} - component: {fileID: 1413215456818694348} - component: {fileID: 483845010817450077} m_Layer: 0 - m_Name: AlienNPC + m_Name: ArcheryRangeNPC m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -229,27 +228,6 @@ MonoBehaviour: OcclusionLayer: serializedVersion: 2 m_Bits: 0 ---- !u!135 &1155083335105893391 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4663194936290788516} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 1 - m_ProvidesContacts: 0 - m_Enabled: 0 - serializedVersion: 3 - m_Radius: 5 - m_Center: {x: 0, y: 0, z: 0} --- !u!65 &7315184541177211783 BoxCollider: m_ObjectHideFlags: 0 @@ -299,7 +277,7 @@ MonoBehaviour: k__BackingField: 0 _scenePathHash: 0 k__BackingField: 0 - k__BackingField: 13446978597385568795 + k__BackingField: 3860407826713619879 _sceneNetworkObjects: - {fileID: 0} - {fileID: 0} diff --git a/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/AlienNPC.prefab.meta b/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/ArcheryRangeNPC.prefab.meta similarity index 100% rename from Assets/_PROJECT/Prefabs/ModelGeneration/Characters/AlienNPC.prefab.meta rename to Assets/_PROJECT/Prefabs/ModelGeneration/Characters/ArcheryRangeNPC.prefab.meta diff --git a/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/CafeWaiterNPC.prefab b/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/CafeWaiterNPC.prefab index 4e3b12da..36b4dde7 100644 --- a/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/CafeWaiterNPC.prefab +++ b/Assets/_PROJECT/Prefabs/ModelGeneration/Characters/CafeWaiterNPC.prefab @@ -209,7 +209,9 @@ MonoBehaviour: notepadText: {fileID: 0} notepad: {fileID: 0} backRoom: {fileID: 0} + plate: {fileID: 0} backRoomMovingTime: 5 + ignorePlayerCollisionLayer: 2 --- !u!114 &7699707098595015193 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/_PROJECT/Scenes/DeltaBuilding_base.unity b/Assets/_PROJECT/Scenes/DeltaBuilding_base.unity index 770c9775..9db4e308 100644 --- a/Assets/_PROJECT/Scenes/DeltaBuilding_base.unity +++ b/Assets/_PROJECT/Scenes/DeltaBuilding_base.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e919800badd9e34386f9cfbf51da5b683b5f425207c3d51761d31ca09ac41222 -size 67957213 +oid sha256:20979ab09f46bdc8e3496951948e448188fd44271391e669a216f4f96d49006b +size 67958334 diff --git a/Assets/_PROJECT/Scripts/Audio/AudioManager.cs b/Assets/_PROJECT/Scripts/Audio/AudioManager.cs index 69c988e2..ccc95a77 100644 --- a/Assets/_PROJECT/Scripts/Audio/AudioManager.cs +++ b/Assets/_PROJECT/Scripts/Audio/AudioManager.cs @@ -3,7 +3,6 @@ using FMODUnity; using System; using System.Collections.Generic; using System.Runtime.InteropServices; -using UnityEditor; using UnityEngine; using UnityEngine.SceneManagement; @@ -49,6 +48,7 @@ public class AudioManager : MonoBehaviour private Bus musicBus; private Bus sfxBus; private Bus uiBus; + private Bus voiceoverBus; const string sid = "00000000-0000-0000-0000-000000000000"; static readonly Guid nullGuid = new Guid(sid); @@ -112,6 +112,7 @@ public class AudioManager : MonoBehaviour _instance.ambientBus = RuntimeManager.GetBus("bus:/Ambiences"); _instance.sfxBus = RuntimeManager.GetBus("bus:/SFX"); _instance.uiBus = RuntimeManager.GetBus("bus:/UI"); + _instance.voiceoverBus = RuntimeManager.GetBus("bus:/Voiceovers"); _instance.masterVCA = RuntimeManager.GetVCA("vca:/Master"); _instance.musicVCA = RuntimeManager.GetVCA("vca:/Music"); @@ -294,7 +295,7 @@ public class AudioManager : MonoBehaviour //=====// //=====// - public void PlayDialogue(string audioTableKey, GameObject emitter = null, float radioAmount = 0f) + public EventInstance PlayDialogue(string audioTableKey, GameObject emitter = null, float radioAmount = 0f) { var dialogueEvent = FMODEvents.Instance.VoiceoverAll; @@ -302,7 +303,7 @@ public class AudioManager : MonoBehaviour if (dialogueEvent.IsNull) { Debug.LogWarning("Dialogue EventReference is not assigned!"); - return; + return default; } EventInstance instance = RuntimeManager.CreateInstance(dialogueEvent); @@ -310,7 +311,7 @@ public class AudioManager : MonoBehaviour if (emitter != null) { RuntimeManager.AttachInstanceToGameObject(instance, emitter); - instance.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(emitter.gameObject)); + instance.set3DAttributes(RuntimeUtils.To3DAttributes(emitter.gameObject)); } // Assign the FMOD parameter value (in this case: Continous type) @@ -334,7 +335,8 @@ public class AudioManager : MonoBehaviour } instance.start(); - instance.release(); + // instance.release(); + return instance; } diff --git a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/AlienNPC.cs b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/ArcheryRangeNPC.cs similarity index 87% rename from Assets/_PROJECT/Scripts/ModeGeneration/NPCs/AlienNPC.cs rename to Assets/_PROJECT/Scripts/ModeGeneration/NPCs/ArcheryRangeNPC.cs index 12b42711..04e7c10e 100644 --- a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/AlienNPC.cs +++ b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/ArcheryRangeNPC.cs @@ -1,6 +1,6 @@ using UnityEngine; -public class AlienNPC : NPCController +public class ArcheryRangeNPC : NPCController { protected override void OnPlayerApproach() { diff --git a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/AlienNPC.cs.meta b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/ArcheryRangeNPC.cs.meta similarity index 100% rename from Assets/_PROJECT/Scripts/ModeGeneration/NPCs/AlienNPC.cs.meta rename to Assets/_PROJECT/Scripts/ModeGeneration/NPCs/ArcheryRangeNPC.cs.meta diff --git a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/CafeWaiterNPC.cs b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/CafeWaiterNPC.cs index 28561925..e018287c 100644 --- a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/CafeWaiterNPC.cs +++ b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/CafeWaiterNPC.cs @@ -47,7 +47,7 @@ public class CafeWaiterNPC : NPCController { if (state == 0) { - AudioManager.Instance.PlayDialogue(voiceLineKeys[0], gameObject); + SpeakVoiceLine(0); fmodWhisperBridge.OnWhisperSegmentUpdated += OnPlayerSpeechUpdate; fmodWhisperBridge.OnWhisperSegmentFinished += OnPlayerSpeechFinished; diff --git a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/NPCController.cs b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/NPCController.cs index 9cca2756..9782c4af 100644 --- a/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/NPCController.cs +++ b/Assets/_PROJECT/Scripts/ModeGeneration/NPCs/NPCController.cs @@ -1,26 +1,42 @@ -using DG.Tweening; +using FMOD.Studio; +using System.IO; +using System.Linq; using UnityEngine; public abstract class NPCController : MonoBehaviour { - private Vector3 mouthClosedScale; - private Vector3 mouthOpenScale; - private bool isTalking; protected Transform playerTransform; - public Transform mouthTransform; - public float mouthScalingMultiplier = 2.5f; - public float mouthMovementDuration = 0.25f; - public string[] voiceLineKeys; + + [Header("Mouth Transform")] + public Transform mouth; // assign your billboard mouth object + + [Header("Mouth Animation Settings")] + public float minScaleY = 0.3f; + public float maxScaleY = 1.0f; + public float gain = 30f; // multiply RMS to make mouth open larger + public float attack = 0.6f; // faster opening + public float release = 0.2f; // slower closing + + [Header("Timeline Folder (StreamingAssets recommended)")] + public string timelineFolder = "CharacterVoicelines"; + + private float[] rmsCurve; + private EventInstance currentVoicelineEvent; + private bool isSpeaking; + private float smoothed; + + private int sampleRate = 50; // RMS samples per second (20ms windows) + // If you change RMS window in Python, update this + + + // Start is called before the first frame update void Awake() { - mouthClosedScale = mouthTransform.localScale; - mouthOpenScale = new Vector3(mouthClosedScale.x, mouthClosedScale.y * mouthScalingMultiplier, mouthClosedScale.z); - - isTalking = false; + } void Start() @@ -37,6 +53,39 @@ public abstract class NPCController : MonoBehaviour Vector3 lookTargetPos = new Vector3(playerTransform.position.x, transform.position.y, playerTransform.position.z); transform.LookAt(lookTargetPos); } + + if (isSpeaking && rmsCurve != null && currentVoicelineEvent.isValid()) + { + AnimateMouth(); + } + } + + private void AnimateMouth() + { + + // get FMOD timeline position + currentVoicelineEvent.getTimelinePosition(out int ms); + float time = ms / 1000f; + + // find sample index + int index = Mathf.FloorToInt(time * sampleRate); + index = Mathf.Clamp(index, 0, rmsCurve.Length - 1); + + float amp = rmsCurve[index] * gain; + + // attack/release smoothing + float targetY = Mathf.Clamp(minScaleY + amp, minScaleY, maxScaleY); + if (targetY > smoothed) + smoothed = Mathf.Lerp(smoothed, targetY, attack); + else + smoothed = Mathf.Lerp(smoothed, targetY, release); + + // apply mouth scale + Vector3 s = mouth.localScale; + s.y = smoothed; + Debug.Log("mouth scale: " + smoothed); + mouth.localScale = s; + } private void OnTriggerEnter(Collider other) @@ -61,39 +110,66 @@ public abstract class NPCController : MonoBehaviour protected virtual void OnPlayerLeave() {} + public void SpeakVoiceLine(int voiceLineId) { - AudioManager.Instance.PlayDialogue(voiceLineKeys[voiceLineId], gameObject); - } - - public void StartTalking() - { - isTalking = true; - MoveMouth(); - } - - public void Stoptalking() - { - isTalking = false; - } - - - private void MoveMouth() - { - if (!isTalking) + if (voiceLineId < 0 || voiceLineId >= voiceLineKeys.Length) { + Debug.LogError("Invalid voiceLineId!"); return; } - if (mouthTransform.localScale == mouthClosedScale) + string key = voiceLineKeys[voiceLineId]; + + LoadCurve(key); // load RMS data + Debug.Log("loaded timeline curve"); + + currentVoicelineEvent = AudioManager.Instance.PlayDialogue(key, gameObject); + + if (!currentVoicelineEvent.isValid()) { - mouthTransform.DOScale(mouthOpenScale, mouthMovementDuration); - } - else - { - mouthTransform.DOScale(mouthClosedScale, mouthMovementDuration); + Debug.LogError("Failed to start dialogue event."); + return; } - Invoke("MoveMouth", mouthMovementDuration + 0.01f); + //isSpeaking = true; + + // Stop mouth on end + currentVoicelineEvent.setCallback((type, inst, param) => + { + if (type == EVENT_CALLBACK_TYPE.STOPPED) + { + isSpeaking = false; + smoothed = minScaleY; + + if (mouth != null) + { + Vector3 s = mouth.localScale; + s.y = minScaleY; + mouth.localScale = s; + } + } + return FMOD.RESULT.OK; + }); + } + +// --------------------------- +// Load RMS Timeline (.txt) +// --------------------------- + private void LoadCurve(string key) + { + string folderPath = Path.Combine(Application.streamingAssetsPath, timelineFolder); + string filePath = Path.Combine(folderPath, key + ".txt"); + + if (!File.Exists(filePath)) + { + Debug.LogError("Missing RMS timeline file: " + filePath); + rmsCurve = null; + return; + } + + var lines = File.ReadAllLines(filePath); + Debug.Log("read lines: " + lines.Length); + rmsCurve = lines.Select(l => float.Parse(l, System.Globalization.CultureInfo.InvariantCulture)).ToArray(); } }