Fix full flow reset cleanup for outlines and residual objects, adjust EndPanel buttons
This commit is contained in:
@@ -120,14 +120,28 @@ public class ChanraoTuibuHandler : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ResetState()
|
||||
{
|
||||
ResetState(true);
|
||||
}
|
||||
|
||||
public void ResetState(bool startBlink)
|
||||
{
|
||||
_isFinished = false;
|
||||
var mr = GetComponent<MeshRenderer>(); if (mr != null) mr.enabled = false;
|
||||
var smr = GetComponent<SkinnedMeshRenderer>(); if (smr != null) smr.enabled = false;
|
||||
foreach (var r in GetComponentsInChildren<Renderer>(true)) { if (_outlineMesh != null && r == _outlineMesh) continue; r.enabled = false; }
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = true;
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = startBlink;
|
||||
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(BlinkOutline());
|
||||
if (startBlink && isActiveAndEnabled)
|
||||
{
|
||||
StartCoroutine(BlinkOutline());
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceHideOutline()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,9 +188,8 @@ public class PingClickHandler : MonoBehaviour
|
||||
remaining++;
|
||||
}
|
||||
|
||||
if (remaining <= 1)
|
||||
if (remaining == 0)
|
||||
{
|
||||
// 彻底修复:使用静态标志位锁定播放动作,这一轮绝不会播两次
|
||||
if (!_hasPlayedFinishVoice)
|
||||
{
|
||||
_hasPlayedFinishVoice = true;
|
||||
@@ -208,7 +207,7 @@ public class PingClickHandler : MonoBehaviour
|
||||
if (uiMgr != null)
|
||||
{
|
||||
uiMgr.HideVideo();
|
||||
uiMgr.ShowEndPanel(); // 调用显示结束面板
|
||||
uiMgr.ShowEndPanel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -250,7 +249,6 @@ public class PingClickHandler : MonoBehaviour
|
||||
_isBlinking = true;
|
||||
_enableFrame = Time.frameCount;
|
||||
|
||||
// 撤销的时候,把语音锁打开,以便能够重新播放
|
||||
_hasPlayedFinishVoice = false;
|
||||
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = true;
|
||||
@@ -282,17 +280,33 @@ public class PingClickHandler : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ResetState()
|
||||
{
|
||||
ResetState(true);
|
||||
}
|
||||
|
||||
public void ResetState(bool startBlink)
|
||||
{
|
||||
_modelShown = false;
|
||||
_isBlinking = true;
|
||||
_isBlinking = startBlink;
|
||||
_enableFrame = Time.frameCount;
|
||||
|
||||
_hasPlayedFinishVoice = false;
|
||||
|
||||
if (_modelRenderer != null) _modelRenderer.enabled = false;
|
||||
if (chanraoObject != null) chanraoObject.SetActive(false);
|
||||
foreach (var r in GetComponentsInChildren<Renderer>(true)) { if (_outlineMesh != null && r == _outlineMesh) continue; r.enabled = false; }
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = true;
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = startBlink;
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(BlinkOutline());
|
||||
if (startBlink && isActiveAndEnabled)
|
||||
{
|
||||
StartCoroutine(BlinkOutline());
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceHideOutline()
|
||||
{
|
||||
_isBlinking = false;
|
||||
StopAllCoroutines();
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,12 @@ public class Point2ClickHandler : MonoBehaviour
|
||||
|
||||
private MeshRenderer _meshRenderer;
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
if (_meshRenderer != null) _meshRenderer.enabled = false;
|
||||
}
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (GetComponent<Collider>() == null) gameObject.AddComponent<SphereCollider>().radius = 0.5f;
|
||||
@@ -92,9 +98,14 @@ public class Point2ClickHandler : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ResetState()
|
||||
{
|
||||
ResetState(true);
|
||||
}
|
||||
|
||||
public void ResetState(bool startBlink)
|
||||
{
|
||||
_clicked = false;
|
||||
if (_meshRenderer != null) _meshRenderer.enabled = true;
|
||||
if (_meshRenderer != null) _meshRenderer.enabled = startBlink;
|
||||
|
||||
if (nextObject != null)
|
||||
{
|
||||
@@ -113,8 +124,11 @@ public class Point2ClickHandler : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
gameObject.SetActive(true);
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(BlinkOutline());
|
||||
gameObject.SetActive(startBlink);
|
||||
if (startBlink && isActiveAndEnabled)
|
||||
{
|
||||
StartCoroutine(BlinkOutline());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
var sc = GetComponent<SphereCollider>(); if(sc != null) sc.enabled = false;
|
||||
var col = GetComponent<BoxCollider>();
|
||||
if (col == null) col = gameObject.AddComponent<BoxCollider>();
|
||||
// Unity 的 BoxCollider.size 处于本地坐标空间,会自动乘上 localScale,这里不能重复缩放
|
||||
col.center = mb.center;
|
||||
col.size = mb.size * 1.2f;
|
||||
col.enabled = true;
|
||||
@@ -104,7 +103,6 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
anim.CrossFade("womanCrouch", 0.1f);
|
||||
}
|
||||
|
||||
// 移动 woman 到 point3
|
||||
var point3 = GameObject.Find("womanPointArray/point3");
|
||||
if (point3 != null)
|
||||
{
|
||||
@@ -121,13 +119,10 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
{
|
||||
anim.SetBool("CheckFoot", true);
|
||||
anim.CrossFade("manInjuryFoot", 0.1f);
|
||||
|
||||
// 启动协程,在动画播放完后将 CheckFoot 重置为 false
|
||||
StartCoroutine(ResetCheckFoot(anim));
|
||||
}
|
||||
}
|
||||
|
||||
// 隐藏 point3 的边框 (touchArray/point3)
|
||||
var touchArray = GameObject.Find("touchArray");
|
||||
if (touchArray != null)
|
||||
{
|
||||
@@ -138,7 +133,6 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// 显示 VideoPanel 并播放视频
|
||||
var uiMgr = FindObjectOfType<UIManager>();
|
||||
if (uiMgr != null)
|
||||
{
|
||||
@@ -147,11 +141,15 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
}
|
||||
|
||||
public void ResetState()
|
||||
{
|
||||
ResetState(true);
|
||||
}
|
||||
|
||||
public void ResetState(bool startBlink)
|
||||
{
|
||||
_clicked = false;
|
||||
|
||||
// 【关键修复】确保 OutlineMesh 在重新激活时处于开启状态并正常闪烁
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = true;
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = startBlink;
|
||||
|
||||
if (_hasRecordedInitialTransform)
|
||||
{
|
||||
@@ -159,7 +157,6 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
transform.rotation = _initialRotation;
|
||||
}
|
||||
|
||||
// 返回时要隐藏 ping
|
||||
if (nextObject != null) nextObject.SetActive(false);
|
||||
|
||||
var uiMgr = FindObjectOfType<UIManager>();
|
||||
@@ -168,7 +165,6 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
uiMgr.HideVideo();
|
||||
}
|
||||
|
||||
// 把 woman 重置(取消蹲下)
|
||||
var woman = GameObject.Find("woman");
|
||||
if (woman != null)
|
||||
{
|
||||
@@ -185,7 +181,6 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// 取消男伤员的 CheckFoot 动作
|
||||
var manInjury = GameObject.Find("manInjury");
|
||||
if (manInjury != null)
|
||||
{
|
||||
@@ -196,7 +191,6 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
// 重新显示 touchArray/point3 的边框
|
||||
var touchArray = GameObject.Find("touchArray");
|
||||
if (touchArray != null)
|
||||
{
|
||||
@@ -208,7 +202,16 @@ public class ShoseClickHandler : MonoBehaviour
|
||||
}
|
||||
|
||||
StopAllCoroutines();
|
||||
StartCoroutine(BlinkOutline());
|
||||
if (startBlink && isActiveAndEnabled)
|
||||
{
|
||||
StartCoroutine(BlinkOutline());
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceHideOutline()
|
||||
{
|
||||
StopAllCoroutines();
|
||||
if (_outlineMesh != null) _outlineMesh.enabled = false;
|
||||
}
|
||||
|
||||
private System.Collections.IEnumerator ResetCheckFoot(Animator anim)
|
||||
|
||||
Reference in New Issue
Block a user