提交
This commit is contained in:
@@ -43,6 +43,11 @@ namespace AibisDream.FixSystem
|
||||
|
||||
[SerializeField] public float plugSnappingRange = 1f;
|
||||
|
||||
private Vector3 _headModuleOriginalPos;
|
||||
private Coroutine _breathingCoroutine;
|
||||
private Coroutine _painShakeCoroutine;
|
||||
private Coroutine _continuousPainCoroutine;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
InitComponentRefs();
|
||||
@@ -228,6 +233,131 @@ namespace AibisDream.FixSystem
|
||||
{
|
||||
BodyModules.Remove(module);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (_headModuleGroup != null)
|
||||
{
|
||||
_headModuleOriginalPos = _headModuleGroup.transform.localPosition;
|
||||
StartBreathing();
|
||||
}
|
||||
}
|
||||
|
||||
public void StartBreathing()
|
||||
{
|
||||
if (_breathingCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_breathingCoroutine);
|
||||
}
|
||||
_breathingCoroutine = StartCoroutine(BreathingAnimation());
|
||||
}
|
||||
|
||||
public void StopBreathing()
|
||||
{
|
||||
if (_breathingCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_breathingCoroutine);
|
||||
_breathingCoroutine = null;
|
||||
}
|
||||
if (_headModuleGroup != null)
|
||||
{
|
||||
_headModuleGroup.transform.localPosition = _headModuleOriginalPos;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator BreathingAnimation()
|
||||
{
|
||||
float time = 0;
|
||||
while (true)
|
||||
{
|
||||
time += Time.deltaTime;
|
||||
float yOffset = Mathf.Sin(time * 2f) * 0.02f; // 调整呼吸幅度和速度
|
||||
_headModuleGroup.transform.localPosition = _headModuleOriginalPos + new Vector3(0, yOffset, 0);
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void TriggerPainShake()
|
||||
{
|
||||
if (_painShakeCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_painShakeCoroutine);
|
||||
}
|
||||
_painShakeCoroutine = StartCoroutine(PainShakeAnimation());
|
||||
}
|
||||
|
||||
private IEnumerator PainShakeAnimation()
|
||||
{
|
||||
StopBreathing();
|
||||
float duration = 0.5f;
|
||||
float elapsed = 0f;
|
||||
Vector3 originalPos = _headModuleGroup.transform.localPosition;
|
||||
|
||||
while (elapsed < duration)
|
||||
{
|
||||
elapsed += Time.deltaTime;
|
||||
float intensity = 1f - (elapsed / duration);
|
||||
_headModuleGroup.transform.localPosition = originalPos + new Vector3(
|
||||
UnityEngine.Random.Range(-0.1f, 0.1f) * intensity,
|
||||
UnityEngine.Random.Range(-0.1f, 0.1f) * intensity,
|
||||
UnityEngine.Random.Range(-0.1f, 0.1f) * intensity
|
||||
);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
_headModuleGroup.transform.localPosition = originalPos;
|
||||
StartBreathing();
|
||||
}
|
||||
|
||||
public void StartContinuousPain()
|
||||
{
|
||||
if (_continuousPainCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_continuousPainCoroutine);
|
||||
}
|
||||
_continuousPainCoroutine = StartCoroutine(ContinuousPainAnimation());
|
||||
}
|
||||
|
||||
public void StopContinuousPain()
|
||||
{
|
||||
if (_continuousPainCoroutine != null)
|
||||
{
|
||||
StopCoroutine(_continuousPainCoroutine);
|
||||
_continuousPainCoroutine = null;
|
||||
}
|
||||
if (_headModuleGroup != null)
|
||||
{
|
||||
_headModuleGroup.transform.localPosition = _headModuleOriginalPos;
|
||||
}
|
||||
StartBreathing();
|
||||
}
|
||||
|
||||
private IEnumerator ContinuousPainAnimation()
|
||||
{
|
||||
StopBreathing();
|
||||
while (true)
|
||||
{
|
||||
// 抖动阶段
|
||||
float shakeDuration = 1f;
|
||||
float shakeElapsed = 0f;
|
||||
Vector3 originalPos = _headModuleGroup.transform.localPosition;
|
||||
|
||||
while (shakeElapsed < shakeDuration)
|
||||
{
|
||||
shakeElapsed += Time.deltaTime;
|
||||
_headModuleGroup.transform.localPosition = originalPos + new Vector3(
|
||||
UnityEngine.Random.Range(-0.05f, 0.05f),
|
||||
UnityEngine.Random.Range(-0.05f, 0.05f),
|
||||
UnityEngine.Random.Range(-0.05f, 0.05f)
|
||||
);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// 暂停阶段
|
||||
_headModuleGroup.transform.localPosition = originalPos;
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[LoadIndex(2)]
|
||||
|
||||
@@ -147,5 +147,35 @@ namespace AibisDream
|
||||
{
|
||||
BodyModuleSystem.CableSystem.PullUpCable();
|
||||
}
|
||||
|
||||
[YarnCommand("StartHeadBreathing")]
|
||||
public static void StartHeadBreathing()
|
||||
{
|
||||
BodyModuleSystem.StartBreathing();
|
||||
}
|
||||
|
||||
[YarnCommand("StopHeadBreathing")]
|
||||
public static void StopHeadBreathing()
|
||||
{
|
||||
BodyModuleSystem.StopBreathing();
|
||||
}
|
||||
|
||||
[YarnCommand("TriggerHeadPainShake")]
|
||||
public static void TriggerHeadPainShake()
|
||||
{
|
||||
BodyModuleSystem.TriggerPainShake();
|
||||
}
|
||||
|
||||
[YarnCommand("StartHeadContinuousPain")]
|
||||
public static void StartHeadContinuousPain()
|
||||
{
|
||||
BodyModuleSystem.StartContinuousPain();
|
||||
}
|
||||
|
||||
[YarnCommand("StopHeadContinuousPain")]
|
||||
public static void StopHeadContinuousPain()
|
||||
{
|
||||
BodyModuleSystem.StopContinuousPain();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,15 @@ namespace AibisDream
|
||||
gearFollower.GearUpdate();
|
||||
}
|
||||
}
|
||||
public void ClearCutLine()
|
||||
{
|
||||
if (gearFollower != null)
|
||||
{
|
||||
gearFollower.ClearCutLine();
|
||||
Destroy(gearFollower.gameObject);
|
||||
gearFollower = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void ActivateGear()
|
||||
{
|
||||
|
||||
@@ -735,6 +735,14 @@ public class GearFollower : MonoBehaviour
|
||||
cuttingManager.OnCutComplete();
|
||||
}
|
||||
}
|
||||
public void ClearCutLine()
|
||||
{
|
||||
if (cutLineRenderer != null)
|
||||
{
|
||||
cutLineRenderer.positionCount = 0;
|
||||
Destroy(this.gameObject);
|
||||
}
|
||||
}
|
||||
public void FinishCutting()
|
||||
{
|
||||
// 清理特效
|
||||
@@ -746,10 +754,7 @@ public class GearFollower : MonoBehaviour
|
||||
{
|
||||
sparkVFX.Stop();
|
||||
}
|
||||
if (cutLineRenderer != null)
|
||||
{
|
||||
cutLineRenderer.positionCount = 0;
|
||||
}
|
||||
|
||||
// 计算随机方向
|
||||
float randomAngle = Random.Range(-cutCompleteTiltAngle, cutCompleteTiltAngle);
|
||||
Vector2 randomOffset = Random.insideUnitCircle * cutCompleteOffset;
|
||||
@@ -787,7 +792,7 @@ public class GearFollower : MonoBehaviour
|
||||
}
|
||||
cutCompleteSequence.OnComplete(() =>
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
|
||||
var cuttingManager = FixSystemCenter.SystemDic.Get<CuttingManager>();
|
||||
if (cuttingManager != null)
|
||||
{
|
||||
|
||||
@@ -7,8 +7,10 @@ public class HeatLineSegmentController : MonoBehaviour
|
||||
private Sequence sequence;
|
||||
|
||||
public float duration = 4f; // 整个冷却淡出时间
|
||||
public Color hotColor = Color.red;
|
||||
public Color coldColor = Color.black;
|
||||
public Color whiteColor = Color.white; // 最热 - 白色
|
||||
public Color orangeColor = new Color(1f, 0.5f, 0f, 1f); // 次热 - 橙色
|
||||
public Color redColor = Color.red; // 较热 - 红色
|
||||
public Color coldColor = Color.black; // 冷却 - 黑色
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -17,7 +19,7 @@ public class HeatLineSegmentController : MonoBehaviour
|
||||
{
|
||||
Debug.LogError("HeatLineSegmentController需要LineRenderer组件");
|
||||
}
|
||||
lineRenderer.startColor = lineRenderer.endColor = hotColor;
|
||||
lineRenderer.startColor = lineRenderer.endColor = whiteColor;
|
||||
}
|
||||
|
||||
void Start()
|
||||
@@ -25,11 +27,23 @@ public class HeatLineSegmentController : MonoBehaviour
|
||||
// 创建颜色渐变序列
|
||||
sequence = DOTween.Sequence();
|
||||
|
||||
// 颜色从热色到冷色
|
||||
// 白色到橙色 (快速过渡)
|
||||
sequence.Append(DOTween.To(() => lineRenderer.startColor, x => {
|
||||
lineRenderer.startColor = x;
|
||||
lineRenderer.endColor = x;
|
||||
}, coldColor, duration * 0.7f).SetEase(Ease.InOutQuad));
|
||||
}, orangeColor, duration * 0.1f).SetEase(Ease.InOutQuad));
|
||||
|
||||
// 橙色到红色
|
||||
sequence.Append(DOTween.To(() => lineRenderer.startColor, x => {
|
||||
lineRenderer.startColor = x;
|
||||
lineRenderer.endColor = x;
|
||||
}, redColor, duration * 0.3f).SetEase(Ease.InOutQuad));
|
||||
|
||||
// 红色到黑色
|
||||
sequence.Append(DOTween.To(() => lineRenderer.startColor, x => {
|
||||
lineRenderer.startColor = x;
|
||||
lineRenderer.endColor = x;
|
||||
}, coldColor, duration * 0.3f).SetEase(Ease.InOutQuad));
|
||||
|
||||
// 淡出效果
|
||||
sequence.Append(DOTween.To(() => lineRenderer.startColor.a, x => {
|
||||
|
||||
Reference in New Issue
Block a user