44 lines
996 B
C#
44 lines
996 B
C#
|
using System;
|
||
|
using Gameplay.Player;
|
||
|
using UnityEngine;
|
||
|
using Interface;
|
||
|
|
||
|
namespace Script.Gameplay.Facility
|
||
|
{
|
||
|
public class DoorInteractController : InteractableBaseController, IEditableComponent
|
||
|
{
|
||
|
[SerializeField] private LockLevel lockLevel;
|
||
|
private bool isOpened = false;
|
||
|
public override void Interact(GameObject interactor)
|
||
|
{
|
||
|
if (isOpened)
|
||
|
{
|
||
|
CloseDoor();
|
||
|
isOpened = false;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
OpenDoor();
|
||
|
isOpened = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public LockLevel LockLevel => lockLevel;
|
||
|
|
||
|
public void SetActive(bool active)
|
||
|
{
|
||
|
// 实现激活或禁用门的逻辑
|
||
|
Interactable = active;
|
||
|
}
|
||
|
|
||
|
private void OpenDoor()
|
||
|
{
|
||
|
Debug.Log("Open door");
|
||
|
}
|
||
|
|
||
|
private void CloseDoor()
|
||
|
{
|
||
|
Debug.Log("Close door");
|
||
|
}
|
||
|
}
|
||
|
}
|