2025-10-18 08:55:38 +08:00
|
|
|
using System;
|
|
|
|
using Gameplay.Player;
|
|
|
|
using UnityEngine;
|
|
|
|
using Interface;
|
|
|
|
|
|
|
|
namespace Script.Gameplay.Facility
|
|
|
|
{
|
|
|
|
public class DoorInteractController : InteractableBaseController, IEditableComponent
|
|
|
|
{
|
|
|
|
[SerializeField] private LockLevel lockLevel;
|
2025-10-18 11:00:06 +08:00
|
|
|
[SerializeField] private bool isActive = true;
|
|
|
|
public bool IsActive
|
|
|
|
{
|
|
|
|
get => isActive;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
isActive = value;
|
|
|
|
//具体被编辑的逻辑
|
|
|
|
Interactable = isActive;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public string ComponentName { get; set; } = "DoorSwitch";
|
|
|
|
public LockLevel LockLevel => lockLevel;
|
2025-10-18 08:55:38 +08:00
|
|
|
private bool isOpened = false;
|
2025-10-18 11:00:06 +08:00
|
|
|
|
2025-10-18 08:55:38 +08:00
|
|
|
public override void Interact(GameObject interactor)
|
|
|
|
{
|
|
|
|
if (isOpened)
|
|
|
|
{
|
|
|
|
CloseDoor();
|
|
|
|
isOpened = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OpenDoor();
|
|
|
|
isOpened = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OpenDoor()
|
|
|
|
{
|
|
|
|
Debug.Log("Open door");
|
|
|
|
}
|
2025-10-18 11:00:06 +08:00
|
|
|
|
2025-10-18 08:55:38 +08:00
|
|
|
private void CloseDoor()
|
|
|
|
{
|
|
|
|
Debug.Log("Close door");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|