feat(): 完成控制台的2中发射信号的模式切换, 优化基本按钮和拉杆的表现

This commit is contained in:
2025-10-22 19:38:22 +08:00
parent 5198a80318
commit 7903e7fdbe
3 changed files with 71 additions and 12 deletions

View File

@@ -9,7 +9,7 @@ namespace Script.Gameplay.Facility
public class ButtonInteractController : BaseFacilityController
{
[SerializeField] private float signalDuration = 1.0f; // 信号持续时间(秒)
private bool IsPressing = true;
private bool isPressing = false;
public override string GetInteractPrompt()
{
@@ -18,21 +18,23 @@ namespace Script.Gameplay.Facility
public override void Interact(GameObject interactor)
{
if (!IsPressing) return;
if (isPressing) return;
StartCoroutine(SendSignalCoroutine());
Debug.Log("Button pressed");
//Debug.Log("Button pressed");
}
private IEnumerator SendSignalCoroutine()
{
SendSignal(true, this.gameObject);
IsPressing = false;
isPressing = true;
// 按钮压下的动画或效果可以在这里添加
transform.localScale = new Vector3(0.3f, 0.3f, 0.1f);
yield return new WaitForSeconds(signalDuration);
SendSignal(false, this.gameObject);
IsPressing = true;
isPressing = false;
// 按钮弹起的动画或效果可以在这里添加
transform.localScale = new Vector3(0.3f, 0.3f, 0.15f);
}
}
}