feat(Connect): 完成连线基本玩法,
This commit is contained in:
@@ -1,28 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Gameplay.Player;
|
||||
using UnityEngine;
|
||||
using Interface;
|
||||
using Script.Gameplay.Connect;
|
||||
|
||||
namespace Script.Gameplay.Facility
|
||||
{
|
||||
public class DoorInteractController : IInteractable, IEditableComponent
|
||||
public class DoorInteractController : MonoBehaviour, IInteractable, IEditableComponent, IConnectable
|
||||
{
|
||||
[SerializeField] private bool isActive = true;
|
||||
#region Interactable
|
||||
|
||||
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进行交互";
|
||||
@@ -55,12 +46,76 @@ namespace Script.Gameplay.Facility
|
||||
|
||||
private void OpenDoor()
|
||||
{
|
||||
// 逆时针旋转90度
|
||||
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0, -90, 0));
|
||||
Debug.Log("Open door");
|
||||
}
|
||||
|
||||
private void CloseDoor()
|
||||
{
|
||||
// 顺时针旋转90度
|
||||
transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0, 90, 0));
|
||||
Debug.Log("Close door");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region EditableComponent
|
||||
|
||||
[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.Red;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Connectable
|
||||
|
||||
public void OnGazeEnter()
|
||||
{
|
||||
}
|
||||
|
||||
public void OnGazeExit()
|
||||
{
|
||||
}
|
||||
|
||||
public Vector3 GetPosition()
|
||||
{
|
||||
return transform.position;
|
||||
}
|
||||
|
||||
public string GetConnectableName()
|
||||
{
|
||||
return gameObject.name;
|
||||
}
|
||||
|
||||
public ConnectionLine OutputConnectionLine { get; set; }
|
||||
public ConnectionLine InputConnectionLine { get; set; }
|
||||
|
||||
public bool IsConnectedOutput { get; set; }
|
||||
public bool IsConnectedInput { get; set; }
|
||||
|
||||
public void ReceiveSignal(bool active, GameObject sender)
|
||||
{
|
||||
Interact(sender);
|
||||
}
|
||||
|
||||
public void SendSignal(bool active, GameObject sender)
|
||||
{
|
||||
OutputConnectionLine.ReceiveSignal(active);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user