mirror of
https://github.com/nothke/quality-control.git
synced 2025-08-08 23:03:43 +00:00
Merge branch 'master' of https://github.com/nothke/quality-control
This commit is contained in:
@@ -2,7 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ConveyorBelt : MonoBehaviour, IResetable
|
||||
public class ConveyorBelt : MonoBehaviour
|
||||
{
|
||||
Rigidbody _rb;
|
||||
Rigidbody rb { get { if (!_rb) _rb = GetComponent<Rigidbody>(); return _rb; } }
|
||||
@@ -15,33 +15,14 @@ public class ConveyorBelt : MonoBehaviour, IResetable
|
||||
public float scrollingTextureSpeedMult = 1;
|
||||
public Renderer scrollingTextureRenderer;
|
||||
|
||||
public AudioClip conveyorClip;
|
||||
public float volume = 0.25f;
|
||||
private AudioSource _audioSource;
|
||||
|
||||
public void ResetMachine()
|
||||
{
|
||||
if (_audioSource)
|
||||
{
|
||||
_audioSource.Stop();
|
||||
Destroy(_audioSource.gameObject);
|
||||
_audioSource = null;
|
||||
}
|
||||
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
_audioSource = NAudio.Play(conveyorClip, transform.position, volume);
|
||||
_audioSource.loop = true;
|
||||
}
|
||||
}
|
||||
public AudioSource audioSource;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
ResetMachine();
|
||||
audioSource.time += Random.Range(1f, 3f);
|
||||
audioSource.pitch = Random.Range(-0.05f, 0.05f) + speed / 2f;
|
||||
|
||||
startPosition = rb.position;
|
||||
|
||||
//scrollingTextureSpeedMult = -0.1625f * speed;
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
|
Reference in New Issue
Block a user