69 lines
2.0 KiB
C#
69 lines
2.0 KiB
C#
using FSM;
|
|
using UnityEngine;
|
|
using ZXKFramework;
|
|
namespace DongWuYiXue.QiGuanChaGuan
|
|
{
|
|
public class BaoLuHuiYanState : FsmState<FSMManager>
|
|
{
|
|
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<QiGuanChaGuan_Sensor>().isHuiYan)
|
|
{
|
|
chaRuValue = 1;
|
|
}
|
|
fsm.PlayClip("暴露会厌_TimeLine", null, chaRuValue);
|
|
if (chaRuValue >= 1.0f)
|
|
{
|
|
if (fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
{
|
|
fsm.AddScore(6, 0);
|
|
}
|
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
{
|
|
fsm.AddScore(6, 0);
|
|
}
|
|
isChaRu = false;
|
|
chaRuValue = 0;
|
|
fsm.nextState = true;
|
|
}
|
|
}
|
|
}
|
|
public override void OnStateExit()
|
|
{
|
|
base.OnStateExit();
|
|
chaRuValue = 0;
|
|
isChaRu = false;
|
|
if (null != cor)
|
|
{
|
|
Game.Instance.IEnumeratorManager.Stop(cor);
|
|
cor = null;
|
|
}
|
|
fsm.nextState = false;
|
|
}
|
|
}
|
|
}
|