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:
@@ -19,7 +19,8 @@ public class ConveyorBelt : MonoBehaviour
|
||||
|
||||
private void Start()
|
||||
{
|
||||
audioSource.time += Random.Range(1f, 3f);
|
||||
float length = audioSource.clip.length;
|
||||
audioSource.time += Random.Range(0.2f * length, 0.4f * length);
|
||||
audioSource.pitch = Random.Range(-0.05f, 0.05f) + speed / 2f;
|
||||
|
||||
startPosition = rb.position;
|
||||
|
@@ -13,14 +13,13 @@ public class LevelObjective : ScriptableObject
|
||||
{
|
||||
public ProductType Type;
|
||||
public int Quantity;
|
||||
[Range(0, 100)]
|
||||
public int MaxDefectivePercentage;
|
||||
}
|
||||
|
||||
public List<ProductQuota> Quotas;
|
||||
|
||||
public float TimeLimit;
|
||||
|
||||
[Range(0, 100)]
|
||||
public int MaxDefectivePercentage;
|
||||
|
||||
[TextArea]
|
||||
public string LevelMessage;
|
||||
|
@@ -169,7 +169,7 @@ public class Scoreboard: MonoBehaviour
|
||||
|
||||
Debug.Log($"{quota.Type.name}: {TotalCount(quota.Type)}/{quota.Quantity}");
|
||||
|
||||
if (CurrentObjective.MaxDefectivePercentage < DefectPercentage(quota.Type))
|
||||
if (quota.MaxDefectivePercentage < DefectPercentage(quota.Type))
|
||||
{
|
||||
success = false;
|
||||
Debug.LogError($"Too many broken {quota.Type.name}");
|
||||
|
@@ -19,8 +19,8 @@ public class Converter: MonoBehaviour, IResetable
|
||||
public float conversionDuration = 5f;
|
||||
private float _conversionTimer;
|
||||
|
||||
[FormerlySerializedAs("conversionSound")] public AudioClip conversionClip;
|
||||
private AudioSource _audioSource;
|
||||
public AudioClip conversionClip;
|
||||
public AudioClip launchClip;
|
||||
|
||||
public Transform refuseLauncher;
|
||||
public float launchPower = 10f;
|
||||
@@ -47,13 +47,6 @@ public class Converter: MonoBehaviour, IResetable
|
||||
CurrentHealth = MaxHealth;
|
||||
|
||||
inputProducts.Clear();
|
||||
|
||||
if (_audioSource)
|
||||
{
|
||||
_audioSource.Stop();
|
||||
Destroy(_audioSource.gameObject);
|
||||
_audioSource = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Update()
|
||||
@@ -86,12 +79,14 @@ public class Converter: MonoBehaviour, IResetable
|
||||
inputProducts.RemoveAt(0);
|
||||
Destroy(currentProduct);
|
||||
|
||||
_audioSource = NAudio.Play(conversionClip, transform.position, 0.75f);
|
||||
NAudio.Play(conversionClip, transform.position, 0.75f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Expel(inputProducts[0]);
|
||||
inputProducts.RemoveAt(0);
|
||||
|
||||
NAudio.Play(launchClip, transform.position);
|
||||
}
|
||||
|
||||
_conversionTimer = conversionDuration;
|
||||
|
@@ -6,6 +6,8 @@ public class ProductSpawner: MonoBehaviour
|
||||
public List<Transform> PossibleOrientations;
|
||||
public Vector2 yRotation;
|
||||
|
||||
public AudioClip spawnClip;
|
||||
|
||||
public void SpawnProduct(ProductType type)
|
||||
{
|
||||
var randomIndex = Random.Range(0, PossibleOrientations.Count);
|
||||
@@ -15,6 +17,7 @@ public class ProductSpawner: MonoBehaviour
|
||||
randomOrientation.rotation;
|
||||
|
||||
ProductType.SpawnProduct(type, transform, randomOrientation.position, rotation);
|
||||
NAudio.Play(spawnClip, transform.position);
|
||||
}
|
||||
|
||||
public void SpawnProduct(ProductType type, DefectType defect)
|
||||
|
Reference in New Issue
Block a user