66 lines
1.5 KiB
C#
66 lines
1.5 KiB
C#
using System;
|
|
using Gameplay.Player;
|
|
using UnityEngine;
|
|
using Interface;
|
|
|
|
namespace Script.Gameplay.Facility
|
|
{
|
|
public class DoorInteractController : IInteractable, IEditableComponent
|
|
{
|
|
[SerializeField] private bool isActive = true;
|
|
public bool Interactable = true;
|
|
public bool IsActive
|
|
{
|
|
get => isActive;
|
|
set
|
|
{
|
|
isActive = value;
|
|
//具体被编辑的逻辑
|
|
Interactable = isActive;
|
|
}
|
|
}
|
|
public string ComponentName { get; set; } = "DoorSwitch";
|
|
public LockLevel LockLevel => LockLevel.Red;
|
|
private bool isOpened = false;
|
|
|
|
public string GetInteractPrompt()
|
|
{
|
|
return "按F进行交互";
|
|
}
|
|
|
|
public void Interact(GameObject interactor)
|
|
{
|
|
if (!Interactable) return;
|
|
if (isOpened)
|
|
{
|
|
CloseDoor();
|
|
isOpened = false;
|
|
}
|
|
else
|
|
{
|
|
OpenDoor();
|
|
isOpened = true;
|
|
}
|
|
}
|
|
|
|
public void OnGazeEnter(GameObject editor)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
public void OnGazeExit(GameObject editor)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
private void OpenDoor()
|
|
{
|
|
Debug.Log("Open door");
|
|
}
|
|
|
|
private void CloseDoor()
|
|
{
|
|
Debug.Log("Close door");
|
|
}
|
|
}
|
|
} |