177 lines
8.7 KiB
C#
177 lines
8.7 KiB
C#
using FSM;
|
|
using System;
|
|
using UnityEngine;
|
|
using ZXKFramework;
|
|
namespace YiLiao.JingMaiLiuZhiZhen
|
|
{
|
|
public class JinZhenState : FsmState<FSMManager>
|
|
{
|
|
public override void OnStateEnter()
|
|
{
|
|
base.OnStateEnter();
|
|
if(fsm.main_gameModel.modeType == ModeType.ShiXun)
|
|
{
|
|
fsm.ShowCamera("JinZhenState_Camera2");
|
|
fsm.ShowTip(0);
|
|
fsm.PlayClip("进针", () => {
|
|
fsm.ShowTip(1);
|
|
fsm.PlayBgm(1);
|
|
fsm.ShowCamera("JinZhenState_Camera2");
|
|
fsm.ShowSlider(new UnityEngine.Vector2(-341f, -50f), 90, 0, 45, value => {
|
|
fsm.Get("留置针前部分").transform.localEulerAngles = new UnityEngine.Vector3(0, -148f, value - 90);
|
|
}, value => {
|
|
if (Convert.ToInt32(value) >= 15 && Convert.ToInt32(value) <= 30)
|
|
{
|
|
fsm.AddScore(2, 1);
|
|
}
|
|
else
|
|
{
|
|
fsm.AddScore(0, 1);
|
|
}
|
|
fsm.Get("留置针前部分").transform.localEulerAngles = new UnityEngine.Vector3(0, -148f, -70);
|
|
fsm.ShowTip(2);
|
|
fsm.PlayBgm(2);
|
|
fsm.Light_EnableInteraction("留置针前部分");
|
|
fsm.ShowArrow("请拖拽进针", "留置针前部分");
|
|
fsm.InteractionDown("留置针前部分", args => {
|
|
fsm.HideArrow();
|
|
fsm.Unlight("留置针前部分");
|
|
});
|
|
});
|
|
fsm.ShowArrow("请拖拽角度进度条", new UnityEngine.Vector3(-342f, -37.8f));
|
|
});
|
|
fsm.InteractionStay("留置针前部分", obj => {
|
|
if (obj.GetComponent<LinearMapping>().value == 1)
|
|
{
|
|
fsm.AddScore(2, 2);
|
|
fsm.ShowTip(3);
|
|
fsm.PlayBgm(3);
|
|
fsm.InteractionStay("留置针前部分", null);
|
|
fsm.Unlight_DisableInteraction("留置针前部分");
|
|
fsm.PlayClip("进针2", () => {
|
|
fsm.ShowSlider(new UnityEngine.Vector2(-341f, -50f), 90, 0, 20, value => {
|
|
fsm.Get("留置针前部分").transform.localEulerAngles = new UnityEngine.Vector3(0, -148f, value - 90);
|
|
}, value => {
|
|
Debug.Log(value);
|
|
if (Convert.ToInt32(value) >= 0 && Convert.ToInt32(value) <= 5)
|
|
{
|
|
fsm.AddScore(2, 3);
|
|
}
|
|
else
|
|
{
|
|
fsm.AddScore(0, 3);
|
|
}
|
|
fsm.ShowTip(4);
|
|
fsm.PlayBgm(4);
|
|
fsm.PlayClip("进针3");
|
|
fsm.Light_EnableInteraction("留置针前部分2");
|
|
fsm.ShowArrow("请拖拽进针", "留置针前部分2");
|
|
fsm.InteractionDown("留置针前部分2", args => {
|
|
fsm.HideArrow();
|
|
fsm.Unlight("留置针前部分2");
|
|
});
|
|
});
|
|
});
|
|
}
|
|
});
|
|
fsm.InteractionStay("留置针前部分2", obj => {
|
|
if (obj.GetComponent<LinearMapping>().value == 1)
|
|
{
|
|
fsm.AddScore(2, 4);
|
|
fsm.InteractionStay("留置针前部分2", null);
|
|
fsm.Unlight_DisableInteraction("留置针前部分2");
|
|
fsm.nextState = true;
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
if (fsm.main_gameModel.modeType == ModeType.KaoHe)
|
|
{
|
|
fsm.ShowCamera("JinZhenState_Camera2");
|
|
fsm.ShowTxtQuestion(2, 4, 1, () => {
|
|
fsm.ShowTip(0, true);
|
|
fsm.PlayClip("进针", () => {
|
|
fsm.ShowTip(1, true);
|
|
fsm.PlayBgm(1, true);
|
|
fsm.ShowCamera("JinZhenState_Camera2");
|
|
fsm.ShowSlider(new UnityEngine.Vector2(-341f, -50f), 90, 0, 45, value => {
|
|
fsm.Get("留置针前部分").transform.localEulerAngles = new UnityEngine.Vector3(0, -148f, value - 90);
|
|
}, value => {
|
|
if (Convert.ToInt32(value) >= 15 && Convert.ToInt32(value) <= 30)
|
|
{
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = true });
|
|
}
|
|
else
|
|
{
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = false });
|
|
}
|
|
fsm.Get("留置针前部分").transform.localEulerAngles = new UnityEngine.Vector3(0, -148f, -70);
|
|
fsm.ShowTip(2, true);
|
|
fsm.PlayBgm(2, true);
|
|
fsm.Light_EnableInteraction("留置针前部分", true);
|
|
fsm.ShowArrow("请拖拽进针", "留置针前部分");
|
|
fsm.InteractionDown("留置针前部分", args => {
|
|
fsm.HideArrow();
|
|
fsm.Unlight("留置针前部分");
|
|
});
|
|
});
|
|
fsm.ShowArrow("请拖拽角度进度条", new UnityEngine.Vector3(-342f, -37.8f));
|
|
});
|
|
fsm.InteractionStay("留置针前部分", obj => {
|
|
if (obj.GetComponent<LinearMapping>().value == 1)
|
|
{
|
|
fsm.HideTip();
|
|
fsm.ShowTxtQuestion(3, 4, 2, () => {
|
|
fsm.ShowTip(3, true);
|
|
fsm.PlayBgm(3, true);
|
|
fsm.InteractionStay("留置针前部分", null);
|
|
fsm.Unlight_DisableInteraction("留置针前部分");
|
|
fsm.PlayClip("进针2", () => {
|
|
fsm.ShowSlider(new UnityEngine.Vector2(-341f, -50f), 90, 0, 20, value => {
|
|
fsm.Get("留置针前部分").transform.localEulerAngles = new UnityEngine.Vector3(0, -148f, value - 90);
|
|
}, value => {
|
|
Debug.Log(value);
|
|
if (Convert.ToInt32(value) >= 0 && Convert.ToInt32(value) <= 5)
|
|
{
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = true });
|
|
}
|
|
else
|
|
{
|
|
Game.Instance.eventManager.Raise(new PlayTrueOrFalseEvent() { isTrue = false });
|
|
}
|
|
fsm.ShowTip(4, true);
|
|
fsm.PlayBgm(4, true);
|
|
fsm.PlayClip("进针3");
|
|
fsm.Light_EnableInteraction("留置针前部分2", true);
|
|
fsm.ShowArrow("请拖拽进针", "留置针前部分2");
|
|
fsm.InteractionDown("留置针前部分2", args => {
|
|
fsm.HideArrow();
|
|
fsm.Unlight("留置针前部分2");
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
});
|
|
fsm.InteractionStay("留置针前部分2", obj => {
|
|
if (obj.GetComponent<LinearMapping>().value == 1)
|
|
{
|
|
fsm.InteractionStay("留置针前部分2", null);
|
|
fsm.Unlight_DisableInteraction("留置针前部分2");
|
|
fsm.nextState = true;
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
public override void OnStateExit()
|
|
{
|
|
base.OnStateExit();
|
|
fsm.HideSlider();
|
|
fsm.nextState = false;
|
|
}
|
|
}
|
|
}
|