Skip to content

Commit ae322e5

Browse files
committed
läksy
coin is messy but workish
1 parent 26545bb commit ae322e5

File tree

6 files changed

+231
-11
lines changed

6 files changed

+231
-11
lines changed

Assets/CoinScript.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ public class CoinScript : MonoBehaviour
77
{
88
float rotatespeed = 90f;
99
public AudioSource coin;
10+
public AudioClip coinclip;
1011

1112
// Start is called before the first frame update
1213
void Start()
1314
{
14-
15+
coin.clip = coinclip;
1516
}
1617

1718
// Update is called once per frame
@@ -25,7 +26,11 @@ private void OnTriggerEnter(Collider other)
2526
//Debug.Log(other.gameObject.name + "hit");
2627
if (other.tag == "Player")
2728
{
28-
//AudioSource.Instantiate(coin);
29+
30+
31+
//coin.Play();
32+
coin.PlayOneShot(coinclip);
33+
//Debug.Log("audio1");
2934
other.GetComponent<Player>().AddCoin();
3035
Destroy(gameObject);
3136
}

Assets/Patterns/1. Command/Rebind keys/MainMenu.unity

+97-1
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ GameObject:
636636
- component: {fileID: 1456069982}
637637
- component: {fileID: 1456069981}
638638
- component: {fileID: 1456069980}
639+
- component: {fileID: 1456069984}
639640
m_Layer: 5
640641
m_Name: Canvas
641642
m_TagString: Untagged
@@ -726,6 +727,102 @@ RectTransform:
726727
m_AnchoredPosition: {x: 0, y: 0}
727728
m_SizeDelta: {x: 0, y: 0}
728729
m_Pivot: {x: 0, y: 0}
730+
--- !u!82 &1456069984
731+
AudioSource:
732+
m_ObjectHideFlags: 0
733+
m_CorrespondingSourceObject: {fileID: 0}
734+
m_PrefabInstance: {fileID: 0}
735+
m_PrefabAsset: {fileID: 0}
736+
m_GameObject: {fileID: 1456069979}
737+
m_Enabled: 1
738+
serializedVersion: 4
739+
OutputAudioMixerGroup: {fileID: 0}
740+
m_audioClip: {fileID: 8300000, guid: f696397db0a26bc47a36cd2a6375c054, type: 3}
741+
m_PlayOnAwake: 1
742+
m_Volume: 1
743+
m_Pitch: 1
744+
Loop: 1
745+
Mute: 0
746+
Spatialize: 0
747+
SpatializePostEffects: 0
748+
Priority: 128
749+
DopplerLevel: 1
750+
MinDistance: 1
751+
MaxDistance: 500
752+
Pan2D: 0
753+
rolloffMode: 0
754+
BypassEffects: 0
755+
BypassListenerEffects: 0
756+
BypassReverbZones: 0
757+
rolloffCustomCurve:
758+
serializedVersion: 2
759+
m_Curve:
760+
- serializedVersion: 3
761+
time: 0
762+
value: 1
763+
inSlope: 0
764+
outSlope: 0
765+
tangentMode: 0
766+
weightedMode: 0
767+
inWeight: 0.33333334
768+
outWeight: 0.33333334
769+
- serializedVersion: 3
770+
time: 1
771+
value: 0
772+
inSlope: 0
773+
outSlope: 0
774+
tangentMode: 0
775+
weightedMode: 0
776+
inWeight: 0.33333334
777+
outWeight: 0.33333334
778+
m_PreInfinity: 2
779+
m_PostInfinity: 2
780+
m_RotationOrder: 4
781+
panLevelCustomCurve:
782+
serializedVersion: 2
783+
m_Curve:
784+
- serializedVersion: 3
785+
time: 0
786+
value: 0
787+
inSlope: 0
788+
outSlope: 0
789+
tangentMode: 0
790+
weightedMode: 0
791+
inWeight: 0.33333334
792+
outWeight: 0.33333334
793+
m_PreInfinity: 2
794+
m_PostInfinity: 2
795+
m_RotationOrder: 4
796+
spreadCustomCurve:
797+
serializedVersion: 2
798+
m_Curve:
799+
- serializedVersion: 3
800+
time: 0
801+
value: 0
802+
inSlope: 0
803+
outSlope: 0
804+
tangentMode: 0
805+
weightedMode: 0
806+
inWeight: 0.33333334
807+
outWeight: 0.33333334
808+
m_PreInfinity: 2
809+
m_PostInfinity: 2
810+
m_RotationOrder: 4
811+
reverbZoneMixCustomCurve:
812+
serializedVersion: 2
813+
m_Curve:
814+
- serializedVersion: 3
815+
time: 0
816+
value: 1
817+
inSlope: 0
818+
outSlope: 0
819+
tangentMode: 0
820+
weightedMode: 0
821+
inWeight: 0.33333334
822+
outWeight: 0.33333334
823+
m_PreInfinity: 2
824+
m_PostInfinity: 2
825+
m_RotationOrder: 4
729826
--- !u!1 &1545655185
730827
GameObject:
731828
m_ObjectHideFlags: 0
@@ -1435,7 +1532,6 @@ MonoBehaviour:
14351532
m_Script: {fileID: 11500000, guid: 34bb07f05a584694db0cb3b05ddd3f15, type: 3}
14361533
m_Name:
14371534
m_EditorClassIdentifier:
1438-
AudioSource: {fileID: 0}
14391535
--- !u!1660057539 &9223372036854775807
14401536
SceneRoots:
14411537
m_ObjectHideFlags: 0

Assets/Patterns/1. Command/Rebind keys/Scripts/GameManager.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
using UnityEngine;
44
using UnityEngine.SceneManagement;
55

6-
public class AudioManager : MonoBehaviour
6+
public class GameManager : MonoBehaviour
77
{
8-
public static AudioManager Instance { get; private set; }
8+
public static GameManager Instance { get; private set; }
99
// Start is called before the first frame update
1010

1111

Assets/Patterns/1. Command/Rebind keys/Scripts/Player.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections;
33
using System.Collections.Generic;
44
using UnityEngine;
5+
using UnityEngine.SceneManagement;
56

67
public class Player : MonoBehaviour
78
{
@@ -32,6 +33,10 @@ public void KillEnemy()
3233
// Update is called once per frame
3334
void Update()
3435
{
35-
36+
if (Input.GetKeyDown(KeyCode.Escape))
37+
{
38+
SceneManager.LoadScene(0);
39+
40+
}
3641
}
3742
}

Assets/Patterns/1. Command/Rebind keys/Scripts/prefabs/coin.prefab

+5-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ GameObject:
1414
- component: {fileID: 3966750419914489744}
1515
- component: {fileID: 7004179606666854464}
1616
- component: {fileID: 4964180247224444497}
17-
- component: {fileID: 1151761795995547929}
17+
- component: {fileID: 7163909977451215331}
1818
m_Layer: 0
1919
m_Name: coin
2020
m_TagString: Untagged
@@ -122,7 +122,8 @@ MonoBehaviour:
122122
m_Script: {fileID: 11500000, guid: feb20e15e874de64a8fb9fce4e45d7aa, type: 3}
123123
m_Name:
124124
m_EditorClassIdentifier:
125-
coin: {fileID: 1151761795995547929}
125+
coin: {fileID: 7163909977451215331}
126+
coinclip: {fileID: 8300000, guid: c84f8cff7db9b444995829a7568abb1d, type: 3}
126127
--- !u!54 &4964180247224444497
127128
Rigidbody:
128129
m_ObjectHideFlags: 0
@@ -150,7 +151,7 @@ Rigidbody:
150151
m_Interpolate: 0
151152
m_Constraints: 62
152153
m_CollisionDetection: 0
153-
--- !u!82 &1151761795995547929
154+
--- !u!82 &7163909977451215331
154155
AudioSource:
155156
m_ObjectHideFlags: 0
156157
m_CorrespondingSourceObject: {fileID: 0}
@@ -168,7 +169,7 @@ AudioSource:
168169
Mute: 0
169170
Spatialize: 0
170171
SpatializePostEffects: 0
171-
Priority: 128
172+
Priority: 200
172173
DopplerLevel: 1
173174
MinDistance: 1
174175
MaxDistance: 500

Assets/Patterns/1. Command/Rebind keys/rebind keys.unity

+114-1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ GameObject:
332332
m_Component:
333333
- component: {fileID: 1249201578}
334334
- component: {fileID: 1249201577}
335+
- component: {fileID: 1249201579}
335336
m_Layer: 0
336337
m_Name: CoinSpawner
337338
m_TagString: Untagged
@@ -352,7 +353,7 @@ MonoBehaviour:
352353
m_Name:
353354
m_EditorClassIdentifier:
354355
coin: {fileID: 7226143630107489779, guid: 37759edf72f91d84499f86c954e8442f, type: 3}
355-
timeInterval: 4
356+
timeInterval: 1
356357
currentime: 0
357358
--- !u!4 &1249201578
358359
Transform:
@@ -369,6 +370,21 @@ Transform:
369370
m_Children: []
370371
m_Father: {fileID: 0}
371372
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
373+
--- !u!114 &1249201579
374+
MonoBehaviour:
375+
m_ObjectHideFlags: 0
376+
m_CorrespondingSourceObject: {fileID: 0}
377+
m_PrefabInstance: {fileID: 0}
378+
m_PrefabAsset: {fileID: 0}
379+
m_GameObject: {fileID: 1249201576}
380+
m_Enabled: 1
381+
m_EditorHideFlags: 0
382+
m_Script: {fileID: 11500000, guid: 454c72f60ce369040a2e6af0f765750c, type: 3}
383+
m_Name:
384+
m_EditorClassIdentifier:
385+
enemy: {fileID: 2619348091900620450, guid: b9298502c833eae42a9bc01654aa1034, type: 3}
386+
timeInterval: 0.9
387+
currentime: 0
372388
--- !u!1 &1272538776
373389
GameObject:
374390
m_ObjectHideFlags: 0
@@ -743,6 +759,7 @@ GameObject:
743759
- component: {fileID: 2042735825}
744760
- component: {fileID: 2042735824}
745761
- component: {fileID: 2042735823}
762+
- component: {fileID: 2042735826}
746763
m_Layer: 0
747764
m_Name: Main Camera
748765
m_TagString: MainCamera
@@ -824,6 +841,102 @@ Transform:
824841
m_Children: []
825842
m_Father: {fileID: 0}
826843
m_LocalEulerAnglesHint: {x: 146.273, y: -180, z: -180}
844+
--- !u!82 &2042735826
845+
AudioSource:
846+
m_ObjectHideFlags: 0
847+
m_CorrespondingSourceObject: {fileID: 0}
848+
m_PrefabInstance: {fileID: 0}
849+
m_PrefabAsset: {fileID: 0}
850+
m_GameObject: {fileID: 2042735822}
851+
m_Enabled: 1
852+
serializedVersion: 4
853+
OutputAudioMixerGroup: {fileID: 0}
854+
m_audioClip: {fileID: 8300000, guid: b517b4cdcce544b45afcedd20f62991e, type: 3}
855+
m_PlayOnAwake: 1
856+
m_Volume: 0.563
857+
m_Pitch: 1
858+
Loop: 1
859+
Mute: 0
860+
Spatialize: 0
861+
SpatializePostEffects: 0
862+
Priority: 128
863+
DopplerLevel: 1
864+
MinDistance: 1
865+
MaxDistance: 500
866+
Pan2D: 0
867+
rolloffMode: 0
868+
BypassEffects: 0
869+
BypassListenerEffects: 0
870+
BypassReverbZones: 0
871+
rolloffCustomCurve:
872+
serializedVersion: 2
873+
m_Curve:
874+
- serializedVersion: 3
875+
time: 0
876+
value: 1
877+
inSlope: 0
878+
outSlope: 0
879+
tangentMode: 0
880+
weightedMode: 0
881+
inWeight: 0.33333334
882+
outWeight: 0.33333334
883+
- serializedVersion: 3
884+
time: 1
885+
value: 0
886+
inSlope: 0
887+
outSlope: 0
888+
tangentMode: 0
889+
weightedMode: 0
890+
inWeight: 0.33333334
891+
outWeight: 0.33333334
892+
m_PreInfinity: 2
893+
m_PostInfinity: 2
894+
m_RotationOrder: 4
895+
panLevelCustomCurve:
896+
serializedVersion: 2
897+
m_Curve:
898+
- serializedVersion: 3
899+
time: 0
900+
value: 0
901+
inSlope: 0
902+
outSlope: 0
903+
tangentMode: 0
904+
weightedMode: 0
905+
inWeight: 0.33333334
906+
outWeight: 0.33333334
907+
m_PreInfinity: 2
908+
m_PostInfinity: 2
909+
m_RotationOrder: 4
910+
spreadCustomCurve:
911+
serializedVersion: 2
912+
m_Curve:
913+
- serializedVersion: 3
914+
time: 0
915+
value: 0
916+
inSlope: 0
917+
outSlope: 0
918+
tangentMode: 0
919+
weightedMode: 0
920+
inWeight: 0.33333334
921+
outWeight: 0.33333334
922+
m_PreInfinity: 2
923+
m_PostInfinity: 2
924+
m_RotationOrder: 4
925+
reverbZoneMixCustomCurve:
926+
serializedVersion: 2
927+
m_Curve:
928+
- serializedVersion: 3
929+
time: 0
930+
value: 1
931+
inSlope: 0
932+
outSlope: 0
933+
tangentMode: 0
934+
weightedMode: 0
935+
inWeight: 0.33333334
936+
outWeight: 0.33333334
937+
m_PreInfinity: 2
938+
m_PostInfinity: 2
939+
m_RotationOrder: 4
827940
--- !u!1660057539 &9223372036854775807
828941
SceneRoots:
829942
m_ObjectHideFlags: 0

0 commit comments

Comments
 (0)