using FSM; using Unity.VisualScripting; using UnityEngine; using ZXKFramework; namespace DongWuYiXue.DaoNiaoShu { public class ChongXiBaoPiQiangState : FsmState { bool isTui = false; float tuiValue = 0; HardwareControl ZhuSheQi; public override void OnStateEnter() { base.OnStateEnter(); this.Log("进入冲洗包皮腔状态"); isTui = false; tuiValue = 0; ZhuSheQi = fsm.Get("20ml注射器放置后").GetComponent(); ZhuSheQi.length = 0f; fsm.Show("20ml注射器"); fsm.ShowCamera("冲洗包皮腔1_Camera"); fsm.ShowTip(0); fsm.PlayBgm(0); fsm.Light_EnableInteraction("20ml注射器"); fsm.ShowArrow("点击注射器", "20ml注射器"); fsm.ShowTipBtn(() => { fsm.Light_EnableInteraction("20ml注射器", true); fsm.ShowArrow("点击注射器", "20ml注射器", 0, 0, 5, true); }, 2); fsm.InteractionDown("20ml注射器", c => { fsm.HideTipBtn(); if (fsm.main_gameModel.modeType == ModeType.ShiXun) { fsm.AddScore(4, 0); } if (fsm.main_gameModel.modeType == ModeType.KaoHe) { fsm.AddScore(3, 0); } fsm.HideArrow(); fsm.Unlight_DisableInteraction("20ml注射器"); fsm.Hide("20ml注射器"); fsm.ShowCamera("冲洗包皮腔2_Camera"); fsm.Show("20ml注射器放置后"); isTui = true; }); } bool isOpen; public override void OnStateStay() { base.OnStateStay(); //if (isTui) //{ // tuiValue += .0005f; // fsm.PlayClip("冲洗包皮腔_TimeLine", null, tuiValue); // //ZhuSheQi.length += .0005f; // //ZhuSheQi.animName = "注射器打入"; // //ZhuSheQi.Move(); //} if (isTui && Input.GetKeyDown(KeyCode.L)) { //ZhuSheQi.length = 1.0f; //ZhuSheQi.animName = "注射器打入"; //ZhuSheQi.Move(); tuiValue = 1.0f; fsm.PlayClip("冲洗包皮腔_TimeLine", null, tuiValue); if (fsm.main_gameModel.modeType == ModeType.ShiXun) { fsm.AddScore(5, 1); } if (fsm.main_gameModel.modeType == ModeType.KaoHe) { fsm.AddScore(5, 1); } isTui = false; fsm.nextState = true; } if (isTui && GameManager.Instance.senSor.GetSensor().isOpen) { isOpen = true; tuiValue = GameManager.Instance.senSor.GetSensor().progressValue; fsm.PlayClip("冲洗包皮腔_TimeLine", null, 1.0f - tuiValue); } if (isOpen && !GameManager.Instance.senSor.GetSensor().isOpen) { tuiValue = 1.0f; fsm.PlayClip("冲洗包皮腔_TimeLine", null, tuiValue); if (fsm.main_gameModel.modeType == ModeType.ShiXun) { fsm.AddScore(5, 1); } if (fsm.main_gameModel.modeType == ModeType.KaoHe) { fsm.AddScore(5, 1); } isTui = false; fsm.nextState = true; } if (tuiValue == 0f && GameManager.Instance.senSor.GetSensor().isOpen && isTui) { if (fsm.main_gameModel.modeType == ModeType.ShiXun) { fsm.AddScore(5, 1); } if (fsm.main_gameModel.modeType == ModeType.KaoHe) { fsm.AddScore(5, 1); } isTui = false; fsm.nextState = true; } } public override void OnStateExit() { base.OnStateExit(); fsm.HideTipBtn(); isOpen = false; isTui = false; fsm.Hide("20ml注射器放置后"); fsm.nextState = false; } } }