feat():为压力板、按钮、拉杆添加音效,为玩家移动添加音效
This commit is contained in:
@@ -14,6 +14,10 @@ namespace Script.Gameplay.Facility
|
||||
private bool isPressing = false;
|
||||
private Vector3 buttonInitialPosition;
|
||||
|
||||
[SerializeField] private AudioClip turnSound;
|
||||
[SerializeField] private AudioClip returnSound;
|
||||
[SerializeField] private AudioSource buttonSound;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
buttonInitialPosition = buttonPressPoint.transform.position;
|
||||
@@ -37,12 +41,16 @@ namespace Script.Gameplay.Facility
|
||||
isPressing = true;
|
||||
// 按钮按下的动画或效果可以在这里添加
|
||||
buttonPressPoint.transform.position = new Vector3(0, 0, 0);
|
||||
buttonSound.clip = turnSound;
|
||||
buttonSound.Play();
|
||||
|
||||
yield return new WaitForSeconds(signalDuration);
|
||||
SendSignal(false, this.gameObject);
|
||||
isPressing = false;
|
||||
// 按钮弹起的动画或效果可以在这里添加
|
||||
buttonPressPoint.transform.position = buttonInitialPosition;
|
||||
buttonSound.clip = returnSound;
|
||||
buttonSound.Play();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user