using FSM; using UnityEngine; using ZXKFramework; namespace DongWuYiXue.QiGuanChaGuan { public class ChaRuQiGuanDaoGuanState : FsmState { bool isChaRu; float chaRuValue; Coroutine cor; public override void OnStateEnter() { base.OnStateEnter(); this.Log("进入插入气管导管状态"); isChaRu = false; chaRuValue = 0; fsm.ShowCamera("插入气管导管_Camera"); fsm.ShowTip(1); fsm.PlayBgm(1); //cor = Game.Instance.IEnumeratorManager.Run(3.0f, () => //{ isChaRu = true; //}); } public override void OnStateStay() { base.OnStateStay(); //if (isChaRu) //{ // //if (Input.GetKeyDown(KeyCode.L)) // //{ // // chaRuValue = 1; // //} // if (GameManager.Instance.senSor.GetSensor().qiGuanDeep > 60) // { // chaRuValue = 1; // } // fsm.PlayClip("插入气管导管_TimeLine", null, chaRuValue); // if (chaRuValue >= 1.0f) // { // isChaRu = false; // chaRuValue = 0; // if (fsm.main_gameModel.modeType == ModeType.KaoHe) // { // fsm.AddScore(6, 0); // fsm.ShowTxtQuestion("插管操作》插入气管导管》步骤2", 3, 1, 3, () => // { // fsm.nextState = true; // }); // } // if (fsm.main_gameModel.modeType == ModeType.ShiXun) // { // fsm.AddScore(8, 0); // fsm.nextState = true; // } // } //} if (isChaRu && Input.GetKeyDown(KeyCode.L)) { isChaRu = false; fsm.PlayClip("插入气管导管_TimeLine", () => { chaRuValue = 0; if (fsm.main_gameModel.modeType == ModeType.KaoHe) { //fsm.AddScore(6, 0); fsm.ShowTxtQuestion("插管操作》插入气管导管》步骤2", 3, 1, 3, () => { fsm.nextState = true; }); } if (fsm.main_gameModel.modeType == ModeType.ShiXun) { //fsm.AddScore(8, 0); fsm.nextState = true; } }); } if (isChaRu && GameManager.Instance.senSor.GetSensor().isOpen) { chaRuValue = GameManager.Instance.senSor.GetSensor().qiGuanDeep / 12; fsm.PlayClip("插入气管导管_TimeLine", null, chaRuValue); } if (chaRuValue >= 1.0f && isChaRu) { isChaRu = false; if (fsm.main_gameModel.modeType == ModeType.KaoHe) { fsm.AddScore(6, 0); fsm.ShowTxtQuestion("插管操作》插入气管导管》步骤2", 3, 1, 3, () => { fsm.nextState = true; }); } if (fsm.main_gameModel.modeType == ModeType.ShiXun) { fsm.AddScore(8, 0); fsm.nextState = true; } if (!GameManager.Instance.senSor.GetSensor().isOpen && isChaRu) { fsm.StopClip("插入气管导管_TimeLine"); } } } public override void OnStateExit() { base.OnStateExit(); isChaRu = false; chaRuValue = 0; if (null != cor) { Game.Instance.IEnumeratorManager.Stop(cor); cor = null; } fsm.nextState = false; } } }