407 lines
17 KiB
C#
407 lines
17 KiB
C#
using FSM;
|
|
using Unity.VisualScripting.Antlr3.Runtime;
|
|
using UnityEngine;
|
|
using ZXKFramework;
|
|
namespace DongWuYiXue.QiGuanChaGuan
|
|
{
|
|
public class JianChaTaoNangQiMiXingState : FsmState<FSMManager>
|
|
{
|
|
/// <summary>
|
|
/// 检查第一根导管
|
|
/// </summary>
|
|
bool isJianChaOne;
|
|
/// <summary>
|
|
/// 检查第二根导管
|
|
/// </summary>
|
|
bool isJianChaTwo;
|
|
/// <summary>
|
|
/// 检查第三根导管
|
|
/// </summary>
|
|
bool isJianChaThree;
|
|
|
|
bool isZhuSheQiTui;
|
|
bool isZhuSheQiLa;
|
|
float tuiValue;
|
|
float laValue;
|
|
bool isOpen;
|
|
Coroutine cor;
|
|
public override void OnStateEnter()
|
|
{
|
|
base.OnStateEnter();
|
|
this.Log("进入检查套囊气密性状态");
|
|
fsm.ShowCamera("检查套囊气密性_Camera");
|
|
isJianChaOne = false;
|
|
isJianChaTwo = false;
|
|
isJianChaThree = false;
|
|
isZhuSheQiLa = false;
|
|
isZhuSheQiTui = false;
|
|
|
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
{
|
|
fsm.ShowTxtQuestion("操作前准备》检查套囊气密性》步骤1", 1, 4, 4, () =>
|
|
{
|
|
fsm.ShowTip(0);
|
|
fsm.PlayBgm(0);
|
|
fsm.Show("5ml注射器");
|
|
fsm.Light_EnableInteraction("5ml注射器");
|
|
fsm.Light("10mm气管导管");
|
|
fsm.EnableInteraction("10气管导管气密性");
|
|
fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器");
|
|
fsm.ShowTipBtn(() =>
|
|
{
|
|
fsm.Light("10mm气管导管", true);
|
|
fsm.Light_EnableInteraction("5ml注射器", true);
|
|
fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器", 0, 0, 5, true);
|
|
}, 2);
|
|
});
|
|
}
|
|
else if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
{
|
|
fsm.ShowTip(0);
|
|
fsm.PlayBgm(0);
|
|
fsm.Show("5ml注射器");
|
|
fsm.Light_EnableInteraction("5ml注射器");
|
|
fsm.Light("10mm气管导管");
|
|
fsm.EnableInteraction("10气管导管气密性");
|
|
fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器");
|
|
}
|
|
fsm.InteractionTrigger("5ml注射器", c =>
|
|
{
|
|
if (c.name.Equals("10气管导管气密性"))
|
|
{
|
|
fsm.PlayClip("检查套囊气密性1准备_TimeLine", () =>
|
|
{
|
|
isJianChaOne = true;
|
|
isZhuSheQiTui = true;
|
|
});
|
|
//if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
//{
|
|
// fsm.AddScore(2, 0);
|
|
//}
|
|
//if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
//{
|
|
// fsm.AddScore(4, 0);
|
|
//}
|
|
fsm.HideArrow();
|
|
fsm.Hide("5ml注射器");
|
|
fsm.DisableInteraction("10气管导管气密性");
|
|
fsm.Unlight_DisableInteraction("5ml注射器");
|
|
fsm.Unlight("10mm气管导管");
|
|
fsm.HideTipBtn();
|
|
//fsm.PlayClip("检查套囊气密性1_TimeLine", () =>
|
|
//{
|
|
// fsm.Show("5ml注射器");
|
|
// fsm.Light_EnableInteraction("5ml注射器");
|
|
// fsm.Light("12mm气管导管");
|
|
// fsm.EnableInteraction("12气管导管检查气密性");
|
|
// fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器");
|
|
// fsm.ShowTipBtn(() =>
|
|
// {
|
|
// this.Error("2222222222222222222");
|
|
// fsm.Light("12mm气管导管", true);
|
|
// fsm.Light_EnableInteraction("5ml注射器", true);
|
|
// fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器", 0, 0, 5, true);
|
|
// }, 2);
|
|
//});
|
|
}
|
|
if (c.name.Equals("12气管导管检查气密性"))
|
|
{
|
|
fsm.PlayClip("检查套囊气密性2准备_TimeLine", () =>
|
|
{
|
|
isJianChaTwo = true;
|
|
isZhuSheQiTui = true;
|
|
});
|
|
//if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
//{
|
|
// fsm.AddScore(2, 1);
|
|
//}
|
|
//if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
//{
|
|
// fsm.AddScore(4, 1);
|
|
//}
|
|
fsm.HideArrow();
|
|
fsm.Hide("5ml注射器");
|
|
fsm.Unlight_DisableInteraction("5ml注射器");
|
|
fsm.Unlight("12mm气管导管");
|
|
fsm.DisableInteraction("12气管导管检查气密性");
|
|
fsm.HideTipBtn();
|
|
//fsm.PlayClip("检查套囊气密性2_TimeLine", () =>
|
|
//{
|
|
// fsm.Show("5ml注射器");
|
|
// fsm.Light_EnableInteraction("5ml注射器");
|
|
// fsm.Light("14mm气管导管");
|
|
// fsm.EnableInteraction("14气管导管检查气密性");
|
|
// fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器");
|
|
// fsm.ShowTipBtn(() =>
|
|
// {
|
|
// this.Error("33333333333333333");
|
|
// fsm.Light("14mm气管导管", true);
|
|
// fsm.Light_EnableInteraction("5ml注射器", true);
|
|
// fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器", 0, 0, 5, true);
|
|
// }, 2);
|
|
//});
|
|
}
|
|
if (c.name.Equals("14气管导管检查气密性"))
|
|
{
|
|
fsm.PlayClip("检查套囊气密性3准备_TimeLine", () =>
|
|
{
|
|
isJianChaThree = true;
|
|
isZhuSheQiTui = true;
|
|
});
|
|
//if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
//{
|
|
// fsm.AddScore(1, 2);
|
|
//}
|
|
//if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
//{
|
|
// fsm.AddScore(4, 2);
|
|
//}
|
|
fsm.HideArrow();
|
|
fsm.Hide("5ml注射器");
|
|
fsm.Unlight_DisableInteraction("5ml注射器");
|
|
fsm.Unlight("14mm气管导管");
|
|
fsm.DisableInteraction("14气管导管检查气密性");
|
|
fsm.HideTipBtn();
|
|
//fsm.PlayClip("检查套囊气密性3_TimeLine", () =>
|
|
//{
|
|
// fsm.nextState = true;
|
|
//});
|
|
}
|
|
});
|
|
}
|
|
public override void OnStateStay()
|
|
{
|
|
base.OnStateStay();
|
|
if (isJianChaOne && isZhuSheQiTui)
|
|
{
|
|
if (GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen)
|
|
{
|
|
isOpen = true;
|
|
tuiValue = GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().progressValue;
|
|
if (tuiValue > 0.1f)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性1_TimeLine", null, (1.0f - tuiValue) / 2);
|
|
}
|
|
else
|
|
{
|
|
isZhuSheQiTui = false;
|
|
isOpen = false;
|
|
isZhuSheQiLa = true;
|
|
}
|
|
}
|
|
else if (!GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen && isOpen)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性1_TimeLine", null, (1.0f - tuiValue) / 2);
|
|
}
|
|
}
|
|
if (isJianChaOne && isZhuSheQiLa)
|
|
{
|
|
if (GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen)
|
|
{
|
|
isOpen = true;
|
|
tuiValue = GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().progressValue;
|
|
if (tuiValue < 1)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性1_TimeLine", null, .5f + (tuiValue / 2));
|
|
}
|
|
else
|
|
{
|
|
isJianChaOne = false;
|
|
isZhuSheQiLa = false;
|
|
isOpen = false;
|
|
|
|
|
|
|
|
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
{
|
|
fsm.AddScore(2, 0);
|
|
}
|
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
{
|
|
fsm.AddScore(4, 0);
|
|
}
|
|
cor = Game.Instance.IEnumeratorManager.Run(1.0f, () =>
|
|
{
|
|
if (null != cor)
|
|
{
|
|
Game.Instance.IEnumeratorManager.Stop(cor);
|
|
}
|
|
fsm.Show("5ml注射器");
|
|
fsm.Light_EnableInteraction("5ml注射器");
|
|
fsm.Light("12mm气管导管");
|
|
fsm.EnableInteraction("12气管导管检查气密性");
|
|
fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器");
|
|
fsm.ShowTipBtn(() =>
|
|
{
|
|
this.Error("2222222222222222222");
|
|
fsm.Light("12mm气管导管", true);
|
|
fsm.Light_EnableInteraction("5ml注射器", true);
|
|
fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器", 0, 0, 5, true);
|
|
}, 2);
|
|
});
|
|
}
|
|
}
|
|
else if (!GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen && isOpen)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性1_TimeLine", null, .5f + (tuiValue / 2));
|
|
}
|
|
}
|
|
|
|
if (isJianChaTwo && isZhuSheQiTui)
|
|
{
|
|
if (GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen)
|
|
{
|
|
isOpen = true;
|
|
tuiValue = GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().progressValue;
|
|
if (tuiValue > 0.1f)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性2_TimeLine", null, (1.0f - tuiValue) / 2);
|
|
}
|
|
else
|
|
{
|
|
isZhuSheQiTui = false;
|
|
isOpen = false;
|
|
isZhuSheQiLa = true;
|
|
}
|
|
}
|
|
else if (!GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen && isOpen)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性2_TimeLine", null, (1.0f - tuiValue) / 2);
|
|
}
|
|
}
|
|
if (isJianChaTwo && isZhuSheQiLa)
|
|
{
|
|
if (GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen)
|
|
{
|
|
isOpen = true;
|
|
tuiValue = GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().progressValue;
|
|
if (tuiValue < 1)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性2_TimeLine", null, .5f + (tuiValue / 2));
|
|
}
|
|
else
|
|
{
|
|
isJianChaTwo = false;
|
|
isZhuSheQiLa = false;
|
|
isOpen = false;
|
|
|
|
|
|
|
|
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
{
|
|
fsm.AddScore(2, 1);
|
|
}
|
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
{
|
|
fsm.AddScore(4, 1);
|
|
}
|
|
cor = Game.Instance.IEnumeratorManager.Run(1.0f, () =>
|
|
{
|
|
if (null != cor)
|
|
{
|
|
Game.Instance.IEnumeratorManager.Stop(cor);
|
|
}
|
|
fsm.Show("5ml注射器");
|
|
fsm.Light_EnableInteraction("5ml注射器");
|
|
fsm.Light("14mm气管导管");
|
|
fsm.EnableInteraction("14气管导管检查气密性");
|
|
fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器");
|
|
fsm.ShowTipBtn(() =>
|
|
{
|
|
this.Error("33333333333333333");
|
|
fsm.Light("14mm气管导管", true);
|
|
fsm.Light_EnableInteraction("5ml注射器", true);
|
|
fsm.ShowArrow("请拖拽10ml注射器", "5ml注射器", 0, 0, 5, true);
|
|
}, 2);
|
|
});
|
|
}
|
|
}
|
|
else if (!GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen && isOpen)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性2_TimeLine", null, .5f + (tuiValue / 2));
|
|
}
|
|
}
|
|
|
|
if (isJianChaThree && isZhuSheQiTui)
|
|
{
|
|
if (GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen)
|
|
{
|
|
isOpen = true;
|
|
tuiValue = GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().progressValue;
|
|
if (tuiValue > 0.1f)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性3_TimeLine", null, (1.0f - tuiValue) / 2);
|
|
}
|
|
else
|
|
{
|
|
isZhuSheQiTui = false;
|
|
isOpen = false;
|
|
isZhuSheQiLa = true;
|
|
}
|
|
}
|
|
else if (!GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen && isOpen)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性3_TimeLine", null, (1.0f - tuiValue) / 2);
|
|
}
|
|
}
|
|
if (isJianChaThree && isZhuSheQiLa)
|
|
{
|
|
if (GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen)
|
|
{
|
|
isOpen = true;
|
|
tuiValue = GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().progressValue;
|
|
if (tuiValue < 1)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性3_TimeLine", null, .5f + (tuiValue / 2));
|
|
}
|
|
else
|
|
{
|
|
isJianChaThree = false;
|
|
isZhuSheQiLa = false;
|
|
isOpen = false;
|
|
|
|
|
|
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
{
|
|
fsm.AddScore(1, 2);
|
|
}
|
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
{
|
|
fsm.AddScore(4, 2);
|
|
}
|
|
cor = Game.Instance.IEnumeratorManager.Run(1.0f, () =>
|
|
{
|
|
if (null != cor)
|
|
{
|
|
Game.Instance.IEnumeratorManager.Stop(cor);
|
|
}
|
|
fsm.nextState = true;
|
|
});
|
|
}
|
|
}
|
|
else if (!GameManager.Instance.senSor.GetSensor<ZhuSheQi_10SenSor>().isOpen && isOpen)
|
|
{
|
|
fsm.PlayClip("检查套囊气密性3_TimeLine", null, .5f + (tuiValue / 2));
|
|
}
|
|
}
|
|
}
|
|
public override void OnStateExit()
|
|
{
|
|
base.OnStateExit();
|
|
if (null != cor)
|
|
{
|
|
Game.Instance.IEnumeratorManager.Stop(cor);
|
|
}
|
|
fsm.Unlight_DisableInteraction("5ml注射器");
|
|
fsm.Unlight("14mm气管导管");
|
|
fsm.DisableInteraction("14气管导管检查气密性");
|
|
fsm.Unlight("12mm气管导管");
|
|
fsm.DisableInteraction("12气管导管检查气密性");
|
|
fsm.Unlight("10mm气管导管");
|
|
fsm.DisableInteraction("10气管导管气密性");
|
|
|
|
fsm.nextState = false;
|
|
}
|
|
}
|
|
}
|