Files
aibis-dream/Assets/Scripts/FixSystemNew/States/BlockPuzzleFixState.cs
T

59 lines
2.2 KiB
C#

using System;
using System.Collections;
using AibisDream.Framework;
using AibisDream.UI;
using DG.Tweening;
using UnityEngine;
namespace AibisDream.FixSystem
{
public struct BlockPuzzleState : IFixState
{
private const string puzzleName = "Game2";
private const float blockPuzzleScale = 1.6f;
private static BlockPuzzleSystem BlockPuzzleSystem => FixSystemCenter.SystemDic.Get<BlockPuzzleSystem>();
private static BodyModuleSystem BodyModuleSystem => FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
public FixState GetState => FixState.BlockPuzzle;
public void SetArgs(string args)
{
}
public IEnumerator Enter()
{
// 基本操作(其实应该早就处理好了)
yield return CameraKit.Instance.SwitchCamera(CameraEnum.BodyModule);
var bubbleData = FixPanelSystem.Instance.BubbleSlotGroup.CollectData();
DialogUIManager.Instance.LoadBubbles(bubbleData);
yield return TimelineCenter.Instance.PlayTimelineAsync(TimelineAssetRef.EngineModuleEnter);
// 视角移动
var engineModule = BodyModuleSystem.FindBodyModuleByName("Heart");
Tween tween = RepairSystemManager.Instance.ScaleCurrentSystem(blockPuzzleScale, engineModule.transform.position);
if (tween != null)
{
yield return tween.WaitForCompletion();
}
// 初始化拼图
BlockPuzzleSystem.Initialize(puzzleName);
// 开启遮罩
yield return FixPanelSystem.Instance.MaskFadeIn();
RepairSystemManager.Instance.SwitchSystem<BlockPuzzleSystem>();
yield return new WaitForSeconds(0.5f);
yield return FixPanelSystem.Instance.MaskFadeOut();
// 播放进场动画
yield return TimelineCenter.Instance.PlayTimelineAsync(TimelineAssetRef.CablePanelExit);
yield return new WaitForSeconds(0.5f);
yield return TimelineCenter.Instance.PlayTimelineAsync(TimelineAssetRef.BlockPuzzleEnter);
// 解锁
BlockPuzzleSystem.SetLocked(false);
}
public IEnumerator Exit()
{
yield break;
}
}
}