2025-10-22 17:34:58 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Script.Gameplay.Interface;
|
|
|
|
|
using Script.Gameplay.Connect;
|
|
|
|
|
|
|
|
|
|
namespace Script.Gameplay.Facility
|
|
|
|
|
{
|
|
|
|
|
public class LeverInteractController : BaseFacilityController
|
|
|
|
|
{
|
|
|
|
|
private bool isPulled = false;
|
|
|
|
|
|
|
|
|
|
public override string GetInteractPrompt()
|
|
|
|
|
{
|
|
|
|
|
return "按F拉动拉杆";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Interact(GameObject interactor)
|
|
|
|
|
{
|
|
|
|
|
if (!IsEnableInteract) return;
|
2025-10-28 08:50:06 +08:00
|
|
|
PullLever(this.gameObject);
|
2025-10-27 10:31:01 +08:00
|
|
|
}
|
|
|
|
|
|
2025-10-28 08:50:06 +08:00
|
|
|
private void PullLever(GameObject sender = null)
|
2025-10-27 10:31:01 +08:00
|
|
|
{
|
2025-10-22 17:34:58 +08:00
|
|
|
isPulled = !isPulled;
|
2025-10-28 08:50:06 +08:00
|
|
|
SendSignal(isPulled, sender);
|
2025-10-22 17:34:58 +08:00
|
|
|
// 可选:拉杆动画
|
2025-10-22 19:38:22 +08:00
|
|
|
if (isPulled)
|
|
|
|
|
{
|
|
|
|
|
// 旋转拉杆到下拉位置
|
|
|
|
|
transform.rotation = Quaternion.Euler(0f, 0f, 45f);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// 旋转拉杆回到初始位置
|
|
|
|
|
transform.rotation = Quaternion.Euler(0f, 0f, 0f);
|
|
|
|
|
}
|
2025-10-22 17:34:58 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|