106 lines
3.2 KiB
C#
106 lines
3.2 KiB
C#
using FSM;
|
|
using UnityEngine;
|
|
using ZXKFramework;
|
|
namespace YiLiao.XinFeiTingZhen
|
|
{
|
|
public class XinLv : FsmState<FSMManager>
|
|
{
|
|
bool step1;
|
|
string id;
|
|
//成功的标志
|
|
string success = "11";
|
|
string audioName = "心率";
|
|
Coroutine cor;
|
|
public override void OnStateEnter()
|
|
{
|
|
base.OnStateEnter();
|
|
fsm.PlayBgm(0);
|
|
fsm.ShowTip(0);
|
|
fsm.PlayClip("二尖瓣区");
|
|
fsm.Light("左锁骨中线与第5肋间交点内0.5cm听诊器位置1");
|
|
fsm.ShowArrow("将实物听诊器放置于左锁骨中线与第5肋间交点内0.5cm处。", "左锁骨中线与第5肋间交点内0.5cm听诊器位置1", 0, 999);
|
|
Countdown();
|
|
}
|
|
void Countdown()
|
|
{
|
|
fsm.HideTzq();
|
|
id = "";
|
|
step1 = true;
|
|
GameManager.Instance.uiManager.ShowUI<CountdownPanel>();
|
|
GameManager.Instance.uiManager.GetUI<CountdownPanel>().StartCountdown(() => {
|
|
fsm.AddScore(0, 0);
|
|
step1 = false;
|
|
Confirm();
|
|
});
|
|
}
|
|
void Confirm()
|
|
{
|
|
GameManager.Instance.uiManager.GetUI<CountdownPanel>().StopCountdown();
|
|
GameManager.Instance.uiManager.GetUI<ConfirmPanel>().ShowConfirmPanel(() => {
|
|
Countdown();
|
|
}, () => {
|
|
fsm.nextState = true;
|
|
});
|
|
}
|
|
void Success()
|
|
{
|
|
step1 = false;
|
|
fsm.AddScore(0, 2f);
|
|
GameManager.Instance.uiManager.GetUI<CountdownPanel>().StopCountdown();
|
|
cor = Game.Instance.IEnumeratorManager.Run(1f, () =>
|
|
{
|
|
GameManager.Instance.uiManager.GetUI<SuccessPanel>().ShowSuccessPanel(() => {
|
|
fsm.nextState = true;
|
|
});
|
|
});
|
|
}
|
|
void False()
|
|
{
|
|
fsm.AddScore(0, 0);
|
|
step1 = false;
|
|
GameManager.Instance.uiManager.GetUI<CountdownPanel>().StopCountdown();
|
|
cor = Game.Instance.IEnumeratorManager.Run(1f, () =>
|
|
{
|
|
Confirm();
|
|
});
|
|
}
|
|
void Audio()
|
|
{
|
|
GameManager.Instance.uiManager.ShowUI<AudioPanel>();
|
|
GameManager.Instance.uiManager.GetUI<AudioPanel>().LoadAudioClip(audioName);
|
|
}
|
|
public override void OnStateStay()
|
|
{
|
|
base.OnStateStay();
|
|
|
|
if (Input.GetKeyDown(KeyCode.L) && step1)
|
|
{
|
|
id = success;
|
|
}
|
|
if (step1)
|
|
{
|
|
fsm.ShowTzq(id);
|
|
if (id == success)
|
|
{
|
|
fsm.HideArrow();
|
|
fsm.Unlight("左锁骨中线与第5肋间交点内0.5cm听诊器位置1");
|
|
Success();
|
|
Audio();
|
|
}
|
|
else if (!string.IsNullOrEmpty(id) && id != success)
|
|
{
|
|
False();
|
|
}
|
|
}
|
|
}
|
|
public override void OnStateExit()
|
|
{
|
|
base.OnStateExit();
|
|
fsm.HideTzq();
|
|
id = "";
|
|
Game.Instance.IEnumeratorManager.Stop(cor);
|
|
fsm.nextState = false;
|
|
}
|
|
}
|
|
}
|