feat(Cycle):实现循环提前检测,修复交互提示消失,按键绑定的事件在重启的时候没能正确,触发循环的提前检测有错误
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Script.Gameplay.Connect;
|
||||
using Script.Gameplay.Global;
|
||||
using Script.Gameplay.Interface;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -15,6 +16,7 @@ namespace Script.Gameplay.Facility
|
||||
[SerializeField] protected int needSignalCount = 1;
|
||||
[SerializeField] protected int currentSignalCount = 0;
|
||||
[SerializeField] protected string componentName;
|
||||
[SerializeField] protected bool isEnableSendSignal = false;
|
||||
|
||||
public virtual bool IsEnableInteract
|
||||
{
|
||||
@@ -44,12 +46,13 @@ namespace Script.Gameplay.Facility
|
||||
get => isEnableConnect;
|
||||
set => isEnableConnect = value;
|
||||
}
|
||||
|
||||
public virtual int NeedSignalCount
|
||||
{
|
||||
get => needSignalCount;
|
||||
set => needSignalCount = value;
|
||||
}
|
||||
|
||||
|
||||
public virtual int CurrentNeedSignalCount
|
||||
{
|
||||
get => currentSignalCount;
|
||||
@@ -111,7 +114,7 @@ namespace Script.Gameplay.Facility
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentNeedSignalCount = Mathf.Max(0, CurrentNeedSignalCount- 1);
|
||||
CurrentNeedSignalCount = Mathf.Max(0, CurrentNeedSignalCount - 1);
|
||||
}
|
||||
|
||||
if (CurrentNeedSignalCount < NeedSignalCount)
|
||||
@@ -121,10 +124,24 @@ namespace Script.Gameplay.Facility
|
||||
// Implement signal received logic here
|
||||
}
|
||||
|
||||
public bool IsEnableSendSignal
|
||||
{
|
||||
get => isEnableSendSignal;
|
||||
set => isEnableSendSignal = value;
|
||||
}
|
||||
|
||||
public virtual void SendSignal(bool active, GameObject sender)
|
||||
{
|
||||
if(!IsEnableSendSignal) return;
|
||||
if (ConnectionLines != null)
|
||||
{
|
||||
if (ISignalSender.IsSendToSignalSender(sender))
|
||||
{
|
||||
// 防止信号回传给发送者自己
|
||||
BUGManager.Instance.LogStackOverflowBUG(this.transform);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var line in ConnectionLines)
|
||||
{
|
||||
line.OnSignalReceived(active, this.gameObject);
|
||||
|
||||
Reference in New Issue
Block a user