完成一版本UF想象和UF检查
This commit is contained in:
@@ -10,6 +10,9 @@ using Yarn.Unity;
|
||||
using DG.Tweening;
|
||||
using VolFx;
|
||||
using System.Drawing.Text; // 引入 DoTween 命名空间
|
||||
using UnityEngine.Rendering.Universal;
|
||||
using System;
|
||||
|
||||
public class UFSystem : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
@@ -20,6 +23,8 @@ public class UFSystem : MonoBehaviour
|
||||
|
||||
public GameObject UFPanel;
|
||||
|
||||
public SpriteRenderer face;
|
||||
|
||||
private bool isLoopImage = false;
|
||||
|
||||
[SerializeField] private Volume FullAscillVolume;
|
||||
@@ -32,6 +37,13 @@ public class UFSystem : MonoBehaviour
|
||||
|
||||
private Tween scaleTween; // 存储 Tween 动画
|
||||
|
||||
public enum UFState
|
||||
{
|
||||
UF,
|
||||
imagination,
|
||||
memory
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
@@ -44,72 +56,125 @@ public class UFSystem : MonoBehaviour
|
||||
// 动态调整权重
|
||||
DOTween.To(() => postProcessingVolume.weight, x => postProcessingVolume.weight = x, targetWeight, duration);
|
||||
}
|
||||
[YarnCommand("UF_UFEffect")]
|
||||
public IEnumerator UF_UFEffect(float duration = 1.5f)
|
||||
[YarnCommand("UF_spriteIn")]
|
||||
public IEnumerator UF_spriteIn(float duration = 1.5f)
|
||||
{
|
||||
if (eyeSystem.CurrentTarget != null)
|
||||
{
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
eyeSystem.CurrentTarget.ImageIn(duration);
|
||||
//TweenWeight(imageVolume, 1, duration);
|
||||
}
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
[YarnCommand("UF_spriteOut")]
|
||||
public IEnumerator UF_spriteOut(float duration = 1.5f)
|
||||
{
|
||||
if (eyeSystem.CurrentTarget != null)
|
||||
{
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
eyeSystem.CurrentTarget.ImageOut(duration);
|
||||
}
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
[YarnCommand("UF_AllspriteIn")]
|
||||
public IEnumerator UF_AllspriteIn(float duration = 1.5f)
|
||||
{
|
||||
foreach (EyeTarget target in eyeSystem.Targets)
|
||||
{
|
||||
target.ImageIn(duration);
|
||||
}
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
[YarnCommand("UF_AllspriteOut")]
|
||||
public IEnumerator UF_AllspriteOut(float duration = 1.5f)
|
||||
{
|
||||
foreach (EyeTarget target in eyeSystem.Targets)
|
||||
{
|
||||
target.ImageOut(duration);
|
||||
}
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
[YarnCommand("UF_faceIn")]
|
||||
public IEnumerator UF_faceIn(float duration = 1.5f)
|
||||
{
|
||||
face.gameObject.SetActive(true);
|
||||
face.DOFade(1f,duration);
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
[YarnCommand("UF_faceOut")]
|
||||
public IEnumerator UF_faceOut(float duration = 1.5f)
|
||||
{
|
||||
face.DOFade(0f,duration);
|
||||
yield return new WaitForSeconds(duration);
|
||||
face.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
[YarnCommand("UF_MmeoryIn")]
|
||||
public IEnumerator UFImageIn(float duration = 1.5f)
|
||||
[YarnCommand("UF_ImaginationEffectIn")]
|
||||
public IEnumerator UF_ImaginationEffectIn(float duration = 1.5f)
|
||||
{
|
||||
if (eyeSystem.CurrentTarget != null)
|
||||
{
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
eyeSystem.CurrentTarget.ImageIn(duration);
|
||||
TweenWeight(imageVolume, 1, duration);
|
||||
}
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
[YarnCommand("UF_MmeoryOut")]
|
||||
public IEnumerator UFImageOut(float duration = 1.5f)
|
||||
{
|
||||
if (eyeSystem.CurrentTarget != null)
|
||||
{
|
||||
eyeSystem.CurrentTarget.ImageOut(duration);
|
||||
TweenWeight(imageVolume, 0, duration);
|
||||
TweenWeight(imageAscillVolume, 1, duration);
|
||||
TweenWeight(finalVolume, 0, duration);
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
}
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
TweenWeight(imageVolume, 1, duration);
|
||||
yield return new WaitForSeconds(0);
|
||||
}
|
||||
[YarnCommand("UF_MmeoryFinished")]
|
||||
public IEnumerator UFImageFinish(float duration = 1.5f)
|
||||
[YarnCommand("UF_ImaginationEffectOut")]
|
||||
public IEnumerator UF_ImaginationEffectOut(float duration = 1.5f)
|
||||
{
|
||||
if (eyeSystem.CurrentTarget != null)
|
||||
{
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
TweenWeight(imageVolume, 0, duration);
|
||||
TweenWeight(imageAscillVolume, 0, duration);
|
||||
TweenWeight(finalVolume, 1, duration);
|
||||
}
|
||||
yield return new WaitForSeconds(duration);
|
||||
TweenWeight(imageVolume, 0, duration);
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
yield return new WaitForSeconds(0);
|
||||
}
|
||||
[YarnCommand("UF_MemoryEffectIn")]
|
||||
public IEnumerator UF_MemoryEffectIn(float duration = 1.5f)
|
||||
{
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
TweenWeight(finalVolume, 1, duration);
|
||||
yield return new WaitForSeconds(0);
|
||||
}
|
||||
[YarnCommand("UF_MemoryEffectOut")]
|
||||
public IEnumerator UF_MemoryEffectOut(float duration = 1.5f)
|
||||
{
|
||||
TweenWeight(finalVolume, 0, duration);
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
yield return new WaitForSeconds(0);
|
||||
}
|
||||
[YarnCommand("UF_EyeTargetAscillIn")]
|
||||
public IEnumerator UF_EyeTargetAscillIn(float duration = 1.5f)
|
||||
{
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
TweenWeight(imageAscillVolume, 1, duration);
|
||||
yield return new WaitForSeconds(0);
|
||||
}
|
||||
[YarnCommand("UF_EyeTargetAscillOut")]
|
||||
public IEnumerator UF_EyeTargetAscillOut(float duration = 1.5f)
|
||||
{
|
||||
TweenWeight(imageAscillVolume, 0, duration);
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
yield return new WaitForSeconds(0);
|
||||
}
|
||||
|
||||
[YarnCommand("UF_SetBorkenValue")]
|
||||
public void UF_Borken(int value)
|
||||
{
|
||||
FullAscillVolume.profile.TryGet<AsciiVol>(out ascii);
|
||||
ascii.m_Depth.value=value;
|
||||
ascii.m_Ascii.value=Color.red;
|
||||
}
|
||||
|
||||
|
||||
[YarnCommand("StartUFEffect_loop")]
|
||||
public void UFImageLoop()
|
||||
{
|
||||
StartCoroutine(UFImageLoopProcess());
|
||||
}
|
||||
|
||||
[YarnCommand("StopUFEffect_loop")]
|
||||
public void StopUFImageLoop()
|
||||
{
|
||||
isLoopImage = false;
|
||||
}
|
||||
[YarnCommand("UF_ImaginationAll")]
|
||||
public void ImageAll()
|
||||
[YarnCommand("UF_fightEffect")]
|
||||
public void UF_fightEffect()
|
||||
{
|
||||
UFImageIn(1);
|
||||
foreach (EyeTarget target in eyeSystem.Targets)
|
||||
{
|
||||
target.ImageIn(1);
|
||||
}
|
||||
scaleTween = DOTween.To(() => 0f, t =>
|
||||
{
|
||||
// 根据 t(0 到 1 的变化)更新多个值
|
||||
@@ -120,6 +185,11 @@ public class UFSystem : MonoBehaviour
|
||||
.SetEase(Ease.InOutSine) // 平滑缓动
|
||||
.SetLoops(-1, LoopType.Yoyo); // 无限循环
|
||||
}
|
||||
[YarnCommand("UF_StopfightEffect")]
|
||||
public void UF_StopfightEffect()
|
||||
{
|
||||
scaleTween.Kill();
|
||||
}
|
||||
|
||||
public IEnumerator UFImageLoopProcess()
|
||||
{
|
||||
@@ -129,13 +199,15 @@ public class UFSystem : MonoBehaviour
|
||||
{
|
||||
eyeSystem.StartCoroutine(eyeSystem.SetTargetCoroutine(eyeSystem.Targets[index].name, false));
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
StartCoroutine(UFImageIn(0.5f));
|
||||
StartCoroutine(UF_spriteIn(0.5f));
|
||||
StartCoroutine(UF_ImaginationEffectIn(0.5f));
|
||||
eyeSystem.Targets[index].ImageIn(0.5f);
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
StartCoroutine(UFImageFinish(0.5f));
|
||||
StartCoroutine(UF_ImaginationEffectOut(0.5f));
|
||||
StartCoroutine(UF_MemoryEffectIn(0.5f));
|
||||
yield return new WaitForSeconds(1f);
|
||||
eyeSystem.Targets[index].ImageOut(0.5f);
|
||||
StartCoroutine(UFImageOut(0.5f));
|
||||
StartCoroutine(UF_MemoryEffectOut(0.5f));
|
||||
index++;
|
||||
// 如果到达列表末尾,则回到开头
|
||||
if (index >= eyeSystem.Targets.Count-2)
|
||||
@@ -188,4 +260,45 @@ public class UFSystem : MonoBehaviour
|
||||
_UFModule.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
[YarnCommand("UF_SwitchState")]
|
||||
public IEnumerator SwitchState(string stateName, float duration)
|
||||
{
|
||||
UFState state;
|
||||
if (!Enum.TryParse(stateName, true, out state))
|
||||
{
|
||||
Debug.LogError($"Invalid state name: {stateName}");
|
||||
yield break;
|
||||
}
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case UFState.UF:
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
TweenWeight(imageAscillVolume, 1, duration);
|
||||
TweenWeight(imageVolume, 0, duration);
|
||||
TweenWeight(finalVolume, 0, duration);
|
||||
break;
|
||||
|
||||
case UFState.imagination:
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
TweenWeight(imageAscillVolume, 0, duration);
|
||||
TweenWeight(imageVolume, 1, duration);
|
||||
TweenWeight(finalVolume, 0, duration);
|
||||
break;
|
||||
|
||||
case UFState.memory:
|
||||
AudioManager.RandomPlayInteraction("colorimagine");
|
||||
TweenWeight(imageAscillVolume, 0, duration);
|
||||
TweenWeight(imageVolume, 0, duration);
|
||||
TweenWeight(finalVolume, 1, duration);
|
||||
break;
|
||||
|
||||
default:
|
||||
Debug.LogError($"Unhandled state: {state}");
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(duration);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user