Первый коммит с LFS.
This commit is contained in:
1 parent
4fcb1e2f24
commit
179816dc4b
5084 files changed
+3714098
-1
No files matched your search
@@ -0,0 +1,29 @@
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
public class KnifeController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Rigidbody[] _knives;
|
||||
[SerializeField] private AudioSource _audioSource;
|
||||
[SerializeField] private AudioClip _fallSound;
|
||||
|
||||
public void DropKnives()
|
||||
{
|
||||
if (_audioSource != null && _fallSound != null)
|
||||
{
|
||||
_audioSource.PlayOneShot(_fallSound);
|
||||
}
|
||||
|
||||
foreach (var knifeRb in _knives)
|
||||
{
|
||||
if (knifeRb != null)
|
||||
{
|
||||
knifeRb.isKinematic = false;
|
||||
knifeRb.useGravity = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Опционально: отключаем этот компонент, чтобы ножи не упали снова
|
||||
// enabled = false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user