This commit is contained in:
nothke
2024-08-19 23:01:30 +02:00
6 changed files with 16432 additions and 44 deletions

View File

@@ -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()