refactor(Facility): 使用继承让所有机关都拥有了独自的 可交互 可编辑 可连接设定。大面积重构
This commit is contained in:
36
Assets/Script/Gameplay/Facility/LeverInteractController.cs
Normal file
36
Assets/Script/Gameplay/Facility/LeverInteractController.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Script.Gameplay.Interface;
|
||||
using Script.Gameplay.Connect;
|
||||
|
||||
namespace Script.Gameplay.Facility
|
||||
{
|
||||
public class LeverInteractController : BaseFacilityController
|
||||
{
|
||||
private bool isPulled = false;
|
||||
|
||||
public override string GetInteractPrompt()
|
||||
{
|
||||
return "按F拉动拉杆";
|
||||
}
|
||||
|
||||
public override void Interact(GameObject interactor)
|
||||
{
|
||||
if (!IsEnableInteract) return;
|
||||
isPulled = !isPulled;
|
||||
SendSignal(isPulled, this.gameObject);
|
||||
// 可选:拉杆动画
|
||||
//Debug.Log(isPulled ? "Lever pulled down" : "Lever reset");
|
||||
}
|
||||
|
||||
public override void OnGazeEnter(GameObject go)
|
||||
{
|
||||
// 可选:高亮拉杆
|
||||
}
|
||||
|
||||
public override void OnGazeExit(GameObject go)
|
||||
{
|
||||
// 可选:取消高亮
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user