]> git.cameronkatri.com Git - gmtk-gamejam.git/commitdiff
Add sound effects for dribble and shoot
authorCameron Katri <me@cameronkatri.com>
Sat, 12 Jun 2021 22:41:18 +0000 (18:41 -0400)
committerCameron Katri <me@cameronkatri.com>
Sat, 12 Jun 2021 22:41:18 +0000 (18:41 -0400)
.gitignore
Assets/.DS_Store [deleted file]
Assets/Prefabs/Hoop.prefab
Assets/Scenes/Main.unity
Assets/Scripts/Controllers/CameraController.cs
Assets/Scripts/Controllers/GameController.cs
Assets/Scripts/Controllers/Hoop.cs
Assets/Sounds/Dribble.mp3 [new file with mode: 0644]
Assets/Sounds/swishsound.wav [new file with mode: 0644]
Assets/Sprites/.DS_Store [deleted file]

index 72c27e4fe2f066bd5cbace2c924414175bd454ec..1c862cc62334718bd48287a168c17ae5c11efe8c 100644 (file)
@@ -69,3 +69,5 @@ crashlytics-build.properties
 # Temporary auto-generated Android Assets
 /[Aa]ssets/[Ss]treamingAssets/aa.meta
 /[Aa]ssets/[Ss]treamingAssets/aa/*
+
+.DS_Store
diff --git a/Assets/.DS_Store b/Assets/.DS_Store
deleted file mode 100644 (file)
index 005151d..0000000
Binary files a/Assets/.DS_Store and /dev/null differ
index 7dfd3b967e57346e38785042341781f0a9ecd200..aaa78b6890e4079a581c338302acab6d5a4c8d96 100644 (file)
@@ -17,6 +17,7 @@ GameObject:
   - component: {fileID: 1029364543094105199}
   - component: {fileID: 2639737386686648195}
   - component: {fileID: 1022133350338841181}
+  - component: {fileID: 5401724803266703353}
   m_Layer: 0
   m_Name: Hoop
   m_TagString: Untagged
@@ -252,3 +253,100 @@ MonoBehaviour:
   m_EditorClassIdentifier: 
   Rim: {fileID: 2639737386686648195}
   Net: {fileID: 1029364543094105199}
+  shotSound: {fileID: 5401724803266703353}
+--- !u!82 &5401724803266703353
+AudioSource:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 2106494524751008836}
+  m_Enabled: 1
+  serializedVersion: 4
+  OutputAudioMixerGroup: {fileID: 0}
+  m_audioClip: {fileID: 8300000, guid: 0626d151c4dfd8345b0f548141ea4a73, type: 3}
+  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
index 3a19e190707a6e5c56347b5122879fa9d0c201ff..dc057fc72244dd178715a4b019aa9a023e17dff6 100644 (file)
@@ -560,6 +560,7 @@ GameObject:
   m_Component:
   - component: {fileID: 1174357919}
   - component: {fileID: 1174357920}
+  - component: {fileID: 1174357921}
   m_Layer: 0
   m_Name: Game
   m_TagString: Untagged
@@ -596,6 +597,103 @@ MonoBehaviour:
   ball: {fileID: 707826158}
   PlayerHoop: {fileID: 614591307}
   EnemyHoop: {fileID: 1354192742}
+  dribbleSound: {fileID: 1174357921}
+--- !u!82 &1174357921
+AudioSource:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 1174357918}
+  m_Enabled: 1
+  serializedVersion: 4
+  OutputAudioMixerGroup: {fileID: 0}
+  m_audioClip: {fileID: 8300000, guid: 09f412701b6b62449ae56680cf2812f5, type: 3}
+  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!4 &1189511746 stripped
 Transform:
   m_CorrespondingSourceObject: {fileID: 6095859834264611321, guid: c64ad9b908cb44602b3d13a74aef751f, type: 3}
index faffbe5f45e0bd9f8fb7d38faf1f76e1bf414b79..7d42be5d3a5d3303b30e24c7593b4229576adefa 100644 (file)
@@ -7,7 +7,7 @@ namespace Controllers
     [SerializeField] private Transform target;
     [SerializeField] private float speed;
 
-    private void Update()
+    private void FixedUpdate()
     {
       transform.position = Vector3.MoveTowards(transform.position, new Vector3(target.transform.position.x, target.transform.position.y, -10f), Time.deltaTime * speed);
     }
index 8dd6fc4482a1ccba888a56b543f66cb170bdbf71..54a04254d80db7b41449e664007274fbbc0352d6 100644 (file)
@@ -21,11 +21,15 @@ namespace Controllers
     [SerializeField] public Hoop PlayerHoop;
     [SerializeField] public Hoop EnemyHoop;
 
+    [SerializeField] public AudioSource dribbleSound;
+
     private void Awake()
     {
       player = new Player { isEnemy = false, controller = this };
       enemy = new Player { isEnemy = true, controller = this };
       ball.controller = this;
+      PlayerHoop.controller = this;
+      EnemyHoop.controller = this;
     }
     
     public struct Player
@@ -88,6 +92,7 @@ namespace Controllers
         if (Vector2.Distance(controller.ball.transform.position, handPosition) >= 1f) return false;
         
         controller.state = dribble;
+        controller.dribbleSound.Play();
         Move(handPosition);
         return true;
       }
@@ -100,6 +105,7 @@ namespace Controllers
       public bool Shoot(Transform playerTransform)
       {
         if (controller.state != dribble) return false; // We must be dribbling the ball to shoot it.
+        controller.dribbleSound.Stop();
         controller.state = shoot;
         controller.ball.Shoot(hoop.transform.position);
         lastShotPosition = playerTransform.position;
@@ -109,6 +115,7 @@ namespace Controllers
 
     internal void BallDropped()
     {
+      dribbleSound.Stop();
       state = State.Idle;
     }
 
index 58f71302d79335662724560e7e5f09793b2bb4f5..56337437f7e1adb39c40361fefab7f16ea1e863a 100644 (file)
@@ -3,17 +3,27 @@ using UnityEngine;
 
 namespace Controllers
 {
+       [RequireComponent(typeof(AudioSource))]
        public class Hoop : MonoBehaviour
        {
+               internal GameController controller;
+               
                [SerializeField] private BoxCollider2D Rim;
                [SerializeField] private BoxCollider2D Net;
+               [SerializeField] private AudioSource shotSound;
                
                private void OnTriggerEnter2D(Collider2D other)
                {
                        if (other.GetComponent<Ball>() == null) return;
-                       
+
                        if (Rim.IsTouching(other) && Net.IsTouching(other))
-                               Debug.Log("Swish!");
+                       {
+                               shotSound.Play();
+                               if (this == controller.PlayerHoop)
+                                       controller.player.Score(Rim.transform.position);
+                               else if (this == controller.EnemyHoop)
+                                       controller.enemy.Score(Rim.transform.position);
+                       }
                }
        }
 }
\ No newline at end of file
diff --git a/Assets/Sounds/Dribble.mp3 b/Assets/Sounds/Dribble.mp3
new file mode 100644 (file)
index 0000000..39f436e
Binary files /dev/null and b/Assets/Sounds/Dribble.mp3 differ
diff --git a/Assets/Sounds/swishsound.wav b/Assets/Sounds/swishsound.wav
new file mode 100644 (file)
index 0000000..187a4b4
Binary files /dev/null and b/Assets/Sounds/swishsound.wav differ
diff --git a/Assets/Sprites/.DS_Store b/Assets/Sprites/.DS_Store
deleted file mode 100644 (file)
index 4568ce0..0000000
Binary files a/Assets/Sprites/.DS_Store and /dev/null differ