287 lines
9.0 KiB
C#
287 lines
9.0 KiB
C#
using System.Collections;
|
|
using AibisDream.Framework;
|
|
using DG.Tweening;
|
|
using UnityEngine;
|
|
|
|
namespace AibisDream.FixSystem
|
|
{
|
|
public enum FixState
|
|
{
|
|
Clinic,
|
|
CoolingMachine,
|
|
BodyModule,
|
|
Memory,
|
|
Eye,
|
|
UF,
|
|
VisualSense,
|
|
Engine,
|
|
Gear
|
|
}
|
|
|
|
public interface ITransitionCommand
|
|
{
|
|
protected static void SetBodyModuleSystemActive(bool active)
|
|
{
|
|
var gearSystem = FixSystemCenter.SystemDic.Get<GearSystem>();
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
|
|
|
gearSystem?.gameObject.SetActive(active);
|
|
bodyModuleSystem?.gameObject.SetActive(active);
|
|
engineSystem?.gameObject.SetActive(active);
|
|
}
|
|
|
|
IEnumerator Execute();
|
|
void SetArgs(string arg);
|
|
}
|
|
|
|
public struct BodyModuleToEngineCommand : ITransitionCommand
|
|
{
|
|
// 引擎相机设置
|
|
private static readonly Vector3 CameraPos = new(-2.5f, 2.13f, -10);
|
|
private const float OrthographicSize = 2.5f;
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
|
|
|
// 插头回到初始插孔
|
|
bodyModuleSystem.ResetPlug();
|
|
// 相机聚焦到目标位
|
|
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
// 打开引擎盖子
|
|
var coverSq = engineSystem.OpenCover();
|
|
while (coverSq.active && !coverSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct EngineToBodyModuleCommand : ITransitionCommand
|
|
{
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var engineSystem = FixSystemCenter.SystemDic.Get<EngineSystem>();
|
|
|
|
// 关闭引擎盖
|
|
var coverSq = engineSystem.CloseCover();
|
|
while (coverSq.active && !coverSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
// 相机还原
|
|
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct BodyModuleToEyeCommand : ITransitionCommand
|
|
{
|
|
// 引擎相机设置
|
|
private static readonly Vector3 CameraPos = new(0f, 0.5f, -10);
|
|
private const float OrthographicSize = 2f;
|
|
private const float Duration = 1f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var eyeSystem = FixSystemCenter.SystemDic.Get<EyeSystem>();
|
|
|
|
// 插头回到初始插孔
|
|
bodyModuleSystem.ResetPlug();
|
|
// 相机聚焦到目标位
|
|
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
|
yield return new WaitForSeconds(Duration/2);
|
|
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
eyeSystem.OpenEyeView();
|
|
eyeSystem.OnEnter();
|
|
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct EyeToBodyModuleCommand : ITransitionCommand
|
|
{
|
|
private const float Duration = 1f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var eyeSystem = FixSystemCenter.SystemDic.Get<EyeSystem>();
|
|
//yield return new WaitForSeconds(Duration/2);
|
|
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
|
eyeSystem.CloseEyeView();
|
|
|
|
// 相机还原
|
|
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
|
yield return new WaitForSeconds(Duration/2);
|
|
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
eyeSystem.OnExit();
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct BodyModuleToMemoryCommand : ITransitionCommand
|
|
{
|
|
// 引擎相机设置
|
|
private static readonly Vector3 CameraPos = new(-2.5f, 5f, -10);
|
|
private const float OrthographicSize = 2.5f;
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var memorySystem = FixSystemCenter.SystemDic.Get<MemoryProcess>();
|
|
yield return memorySystem.DropMemoryProjector();
|
|
// 插头回到初始插孔
|
|
bodyModuleSystem.ResetPlug();
|
|
// 相机聚焦到目标位
|
|
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
|
yield return new WaitForSeconds(Duration/2);
|
|
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
memorySystem.OpenMemoryView();
|
|
memorySystem.OnShow();
|
|
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct MemoryToBodyModuleCommand : ITransitionCommand
|
|
{
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var memorySystem = FixSystemCenter.SystemDic.Get<MemoryProcess>();
|
|
|
|
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
|
memorySystem.OnExit();
|
|
memorySystem.CloseMemoryView();
|
|
// 相机还原
|
|
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
|
yield return new WaitForSeconds(Duration/2);
|
|
|
|
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
|
yield return memorySystem.PullMemoryProjector();
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct BodyModuleToUFCommand : ITransitionCommand
|
|
{
|
|
// 引擎相机设置
|
|
private static readonly Vector3 CameraPos = new(-4.5f, 0.5f, -10);
|
|
private const float OrthographicSize = 2.5f;
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var bodyModuleSystem = FixSystemCenter.SystemDic.Get<BodyModuleSystem>();
|
|
var UFSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
|
// 插头回到初始插孔
|
|
bodyModuleSystem.ResetPlug();
|
|
// 相机聚焦到目标位
|
|
var cameraSq = CameraKit.Instance.TransCamera(CameraPos, OrthographicSize, Duration);
|
|
yield return new WaitForSeconds(Duration/2);
|
|
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
UFSystem.OpenUFView();
|
|
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
|
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
|
|
public struct UFToBodyModuleCommand : ITransitionCommand
|
|
{
|
|
private const float Duration = 2f;
|
|
|
|
public IEnumerator Execute()
|
|
{
|
|
var UFSystem = FixSystemCenter.SystemDic.Get<UFSystem>();
|
|
|
|
yield return MainUIController.Instance.FadeInSync(Duration/2);
|
|
UFSystem.CloseUFView();
|
|
|
|
// 相机还原
|
|
var cameraSq = CameraKit.Instance.ReturnInitCamera(Duration);
|
|
yield return new WaitForSeconds(Duration/2);
|
|
yield return MainUIController.Instance.FadeOutSync(Duration/2);
|
|
while (cameraSq.active && !cameraSq.IsComplete())
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public void SetArgs(string arg)
|
|
{
|
|
// 添加参数
|
|
}
|
|
}
|
|
} |