109 lines
3.2 KiB
C#
109 lines
3.2 KiB
C#
using FSM;
|
|
using UnityEngine;
|
|
using ZXKFramework;
|
|
namespace DongWuYiXue.QiGuanChaGuan
|
|
{
|
|
public class ChongYingTaoNangState : FsmState<FSMManager>
|
|
{
|
|
bool isLa;
|
|
float laValue;
|
|
|
|
bool isTui;
|
|
float tuiValue;
|
|
Coroutine cor;
|
|
Coroutine cor2;
|
|
public override void OnStateEnter()
|
|
{
|
|
base.OnStateEnter();
|
|
this.Log("进入充盈套囊状态");
|
|
|
|
isLa = false;
|
|
laValue = 0;
|
|
isTui = false;
|
|
tuiValue = 0;
|
|
|
|
fsm.ShowTip(1);
|
|
fsm.PlayBgm(1);
|
|
fsm.ShowCamera("充盈套囊_Camera");
|
|
fsm.Show("实物5ml注射器");
|
|
|
|
cor = Game.Instance.IEnumeratorManager.Run(3.0f, () =>
|
|
{
|
|
isLa = true;
|
|
});
|
|
}
|
|
public override void OnStateStay()
|
|
{
|
|
base.OnStateStay();
|
|
if (isLa)
|
|
{
|
|
laValue = GameManager.Instance.senSor.GetSensor<ZhuSheQi_5SenSor>().progressValue;
|
|
fsm.PlayClip("充盈胃囊拉_TimeLine", null, laValue);
|
|
if (Input.GetKeyDown(KeyCode.L))
|
|
{
|
|
laValue = 1.0f;
|
|
fsm.PlayClip("充盈胃囊拉_TimeLine", null, laValue);
|
|
}
|
|
if (laValue >= 1.0f)
|
|
{
|
|
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
{
|
|
fsm.AddScore(5, 0);
|
|
}
|
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
{
|
|
fsm.AddScore(4, 0);
|
|
}
|
|
isLa = false;
|
|
laValue = 0;
|
|
cor2 = Game.Instance.IEnumeratorManager.Run(1.0f, () =>
|
|
{
|
|
isTui = true;
|
|
});
|
|
fsm.ShowTip(3);
|
|
fsm.PlayBgm(3);
|
|
}
|
|
}
|
|
if (isTui)
|
|
{
|
|
tuiValue = 1 - GameManager.Instance.senSor.GetSensor<ZhuSheQi_5SenSor>().progressValue;
|
|
fsm.PlayClip("充盈胃囊推_TimeLine", null, tuiValue);
|
|
if (Input.GetKeyDown(KeyCode.L))
|
|
{
|
|
tuiValue = 1.0f;
|
|
}
|
|
if (tuiValue >= 1.0f)
|
|
{
|
|
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
{
|
|
fsm.AddScore(5, 1);
|
|
}
|
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
{
|
|
fsm.AddScore(2, 1);
|
|
}
|
|
isTui = false;
|
|
tuiValue = 0;
|
|
fsm.nextState = true;
|
|
fsm.Hide("实物5ml注射器");
|
|
}
|
|
}
|
|
}
|
|
public override void OnStateExit()
|
|
{
|
|
base.OnStateExit();
|
|
fsm.Hide("实物5ml注射器");
|
|
if (null != cor)
|
|
{
|
|
Game.Instance.IEnumeratorManager.Stop(cor);
|
|
cor = null;
|
|
}
|
|
isLa = false;
|
|
laValue = 0;
|
|
isTui = false;
|
|
tuiValue = 0;
|
|
fsm.nextState = false;
|
|
}
|
|
}
|
|
}
|