2025-10-22 17:34:58 +08:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Script.Gameplay.Player;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Script.Gameplay.Interface;
|
|
|
|
|
using Script.Gameplay.Connect;
|
|
|
|
|
|
|
|
|
|
namespace Script.Gameplay.Facility
|
|
|
|
|
{
|
|
|
|
|
public class DoorInteractController : BaseFacilityController
|
|
|
|
|
{
|
|
|
|
|
private bool isOpened = false;
|
|
|
|
|
public override string GetInteractPrompt()
|
|
|
|
|
{
|
|
|
|
|
return "按F进行交互";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Interact(GameObject interactor)
|
|
|
|
|
{
|
|
|
|
|
if (isOpened)
|
|
|
|
|
{
|
|
|
|
|
CloseDoor();
|
|
|
|
|
isOpened = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
OpenDoor();
|
|
|
|
|
isOpened = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnGazeEnter(GameObject go)
|
|
|
|
|
{
|
|
|
|
|
// 可扩展:门被注视时的逻辑
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnGazeExit(GameObject go)
|
|
|
|
|
{
|
|
|
|
|
// 可扩展:门离开注视时的逻辑
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OpenDoor()
|
|
|
|
|
{
|
|
|
|
|
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0, -90, 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void CloseDoor()
|
|
|
|
|
{
|
|
|
|
|
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0, 90, 0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public override void OnSignalReceived(bool active, GameObject sender)
|
|
|
|
|
{
|
2025-10-26 22:13:15 +08:00
|
|
|
base.OnSignalReceived(active, sender);
|
2025-10-22 17:34:58 +08:00
|
|
|
Interact(sender);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|