This commit is contained in:
yzx 2024-01-19 15:55:03 +08:00
parent 44a2b87165
commit 8854d442f5
10 changed files with 21 additions and 8 deletions

View File

@ -441160,8 +441160,8 @@ MonoBehaviour:
shache: shache:
- {fileID: 469820069} - {fileID: 469820069}
- {fileID: 1337615172} - {fileID: 1337615172}
ui3d: {fileID: 0} ui3d: {fileID: 67935768}
ui2d: {fileID: 0} ui2d: {fileID: 1944520099}
--- !u!1 &1276928531 --- !u!1 &1276928531
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -457133,6 +457133,7 @@ MonoBehaviour:
mesh: {fileID: -7193705671270685957, guid: efe2b86486a526a4e809023d89746bad, type: 3} mesh: {fileID: -7193705671270685957, guid: efe2b86486a526a4e809023d89746bad, type: 3}
meshFilter: {fileID: 468594977} meshFilter: {fileID: 468594977}
animator: {fileID: 34988786} animator: {fileID: 34988786}
isOpen: 1
--- !u!1 &1323235811 --- !u!1 &1323235811
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -712513,7 +712514,7 @@ PrefabInstance:
- target: {fileID: 4279975699638886894, guid: 4292160a5e1fde347934ac660b2c5d30, - target: {fileID: 4279975699638886894, guid: 4292160a5e1fde347934ac660b2c5d30,
type: 3} type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 1.313 value: 1.34
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4279975699638886894, guid: 4292160a5e1fde347934ac660b2c5d30, - target: {fileID: 4279975699638886894, guid: 4292160a5e1fde347934ac660b2c5d30,
type: 3} type: 3}

View File

@ -24,6 +24,7 @@ public class AccidentManager : MonoBehaviour
public Animator animator; // 将Animator组件拖拽到这个字段 public Animator animator; // 将Animator组件拖拽到这个字段
private bool isPlaying = false; private bool isPlaying = false;
public bool isOpen = true;
public void Close() public void Close()
{ {
for (int i = 0; i < uis.transform.Find("UI").childCount; i++) for (int i = 0; i < uis.transform.Find("UI").childCount; i++)
@ -47,6 +48,10 @@ public class AccidentManager : MonoBehaviour
public async Task Tr(Transform other, bool b = false) public async Task Tr(Transform other, bool b = false)
{ {
if (isOpen)
return;
triggerName = other.name; triggerName = other.name;
@ -102,6 +107,8 @@ public class AccidentManager : MonoBehaviour
PlayAnimationSequence("MsgWinAnimOpen", "MsgWinAnimClose"); PlayAnimationSequence("MsgWinAnimOpen", "MsgWinAnimClose");
uis.transform.Find("UI").Find("刹车失灵").gameObject.SetActive(true); uis.transform.Find("UI").Find("刹车失灵").gameObject.SetActive(true);
} }
} }
IEnumerator dengdai() IEnumerator dengdai()
{ {
@ -196,12 +203,16 @@ public class AccidentManager : MonoBehaviour
// 用于外部调用的方法,启动动画序列 // 用于外部调用的方法,启动动画序列
public void PlayAnimationSequence(string firstAnimation, string secondAnimation) public void PlayAnimationSequence(string firstAnimation, string secondAnimation)
{ {
Close(); Close();
if (!isPlaying) if (!isPlaying)
{ {
Debug.Log("12312312312312312321"); Debug.Log("12312312312312312321");
StartCoroutine(PlayAnimations(firstAnimation, secondAnimation)); StartCoroutine(PlayAnimations(firstAnimation, secondAnimation));
} }
} }
// 协程,按顺序播放动画,并在两个动画之间等待 // 协程,按顺序播放动画,并在两个动画之间等待
@ -222,6 +233,8 @@ public class AccidentManager : MonoBehaviour
// 等待第二个动画播放完毕 // 等待第二个动画播放完毕
yield return new WaitUntil(() => !animator.GetCurrentAnimatorStateInfo(0).IsName(secondAnimation)); yield return new WaitUntil(() => !animator.GetCurrentAnimatorStateInfo(0).IsName(secondAnimation));
yield return new WaitForSeconds(20);
isPlaying = false; isPlaying = false;
} }

View File

@ -28,7 +28,6 @@ namespace Script.Manaegr
public void Init() public void Init()
{ {
vehicleController.maxSpeedForward = 11; vehicleController.maxSpeedForward = 11;