Commit ffeab944 authored by Adam Štěpánek's avatar Adam Štěpánek
Browse files

Knock

parent 2ebd137f
Loading
Loading
Loading
Loading
Loading

Assets/Audio/knock.wav

0 → 100644LFS
+131 B

File added.

No diff preview for this file type.

+43 −0
Original line number Diff line number Diff line
fileFormatVersion: 2
guid: c4e7557529019684596cbcca1b0152fb
AudioImporter:
  externalObjects: {}
  serializedVersion: 6
  defaultSettings:
    loadType: 0
    sampleRateSetting: 0
    sampleRateOverride: 44100
    compressionFormat: 0
    quality: 1
    conversionMode: 0
  platformSettingOverrides:
    4:
      loadType: 0
      sampleRateSetting: 0
      sampleRateOverride: 44100
      compressionFormat: 3
      quality: 1
      conversionMode: 0
    7:
      loadType: 0
      sampleRateSetting: 0
      sampleRateOverride: 44100
      compressionFormat: 1
      quality: 1
      conversionMode: 0
    13:
      loadType: 0
      sampleRateSetting: 2
      sampleRateOverride: 44100
      compressionFormat: 7
      quality: 1
      conversionMode: 0
  forceToMono: 0
  normalize: 1
  preloadAudioData: 1
  loadInBackground: 0
  ambisonic: 0
  3D: 1
  userData: 
  assetBundleName: 
  assetBundleVariant: 
+2 −0
Original line number Diff line number Diff line
@@ -106,6 +106,8 @@ MonoBehaviour:
  ShotSpeed: 10
  ShotDamage: 50
  Shot: {fileID: 5498966872552307195, guid: a01425121aa91db41a1312fdbe89601e, type: 3}
  Sound: {fileID: 8300000, guid: c4e7557529019684596cbcca1b0152fb, type: 3}
  SoundVolume: 0.2
--- !u!95 &3756859516283072286
Animator:
  serializedVersion: 3
+4 −1
Original line number Diff line number Diff line
@@ -35,7 +35,10 @@ public class BeatMaster : MonoBehaviour
    }

    public void PlayOnce(AudioClip clip, float volume = 1)
    {
        if (source is object && clip != null)
        {
            source.PlayOneShot(clip, volume);
        }
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@ public class TeapotGun : MonoBehaviour
    public float ShotSpeed = 10;
    public int ShotDamage = 10;
    public GameObject Shot;
    public AudioClip Sound;
    public float SoundVolume;

    private float lastShot = 0;

@@ -22,6 +24,7 @@ public class TeapotGun : MonoBehaviour
        lastShot = Time.fixedTime;
        var shot = Instantiate(Shot, transform.position, transform.rotation);
        shot.layer = ShotLayer;
        BeatMaster.Instance.PlayOnce(Sound, SoundVolume);

        shot.GetComponent<MetaShot>().SourceGun = this;