mirror of
https://github.com/nothke/quality-control.git
synced 2025-08-11 08:03:44 +00:00
Audio for some of the machines
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class Converter: MonoBehaviour, IResetable
|
||||
{
|
||||
@@ -17,6 +18,9 @@ public class Converter: MonoBehaviour, IResetable
|
||||
public float conversionDuration = 5f;
|
||||
private float _conversionTimer;
|
||||
|
||||
[FormerlySerializedAs("conversionSound")] public AudioClip conversionClip;
|
||||
private AudioSource _audioSource;
|
||||
|
||||
public Transform refuseLauncher;
|
||||
public float launchPower = 10f;
|
||||
|
||||
@@ -42,6 +46,13 @@ public class Converter: MonoBehaviour, IResetable
|
||||
CurrentHealth = MaxHealth;
|
||||
|
||||
inputProducts.Clear();
|
||||
|
||||
if (_audioSource)
|
||||
{
|
||||
_audioSource.Stop();
|
||||
Destroy(_audioSource.gameObject);
|
||||
_audioSource = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
@@ -65,6 +76,8 @@ public class Converter: MonoBehaviour, IResetable
|
||||
Spawner.SpawnProduct(conversionProduct, currentProduct.Defect);
|
||||
inputProducts.RemoveAt(0);
|
||||
Destroy(currentProduct);
|
||||
|
||||
_audioSource = NAudio.Play(conversionClip, transform.position, 0.75f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Reference in New Issue
Block a user