Feel滚
This commit is contained in:
@@ -1,22 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Cielonos.MainGame.Effects.Feedback;
|
||||
using Lean.Pool;
|
||||
using MoreMountains.Feedbacks;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
using SLSUtilities.Feedback;
|
||||
using SLSUtilities.FeelAssistance;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
public partial class FeedbackSubcontroller : SubcontrollerBase<CharacterBase>
|
||||
{
|
||||
// === 旧系统(Feel)—— 保留向后兼容 ===
|
||||
public Dictionary<string, FeedbackUnit> feedbacks;
|
||||
public FeedbackUnit this[string feedbackName] => feedbacks?.GetValueOrDefault(feedbackName, null);
|
||||
|
||||
// === 新系统(Feedback System)===
|
||||
public FeedbackDataCollection feedbackDataCollection;
|
||||
public FeedbackData this[string feedbackName] => GetFeedbackData(feedbackName);
|
||||
|
||||
private CharacterFeedbackTimeProvider _timeProvider;
|
||||
private readonly List<FeedbackPlayer> _activePlayers = new List<FeedbackPlayer>(8);
|
||||
@@ -99,6 +91,19 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按名称停止正在播放的 Feedback。
|
||||
/// </summary>
|
||||
public void StopFeedback(string feedbackName)
|
||||
{
|
||||
if (feedbackDataCollection == null) return;
|
||||
if (feedbackDataCollection.TryGet(feedbackName, out FeedbackData data))
|
||||
{
|
||||
StopFeedback(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 停止所有活跃的新系统播放器。
|
||||
@@ -114,18 +119,6 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// 旧系统驱动
|
||||
if (feedbacks != null)
|
||||
{
|
||||
foreach (var feedbackUnit in feedbacks.Values)
|
||||
{
|
||||
float timeScaleMultiplier = owner.selfTimeSm.TimeScale;
|
||||
feedbackUnit.feedback.ExternalTimeScale = timeScaleMultiplier;
|
||||
feedbackUnit.Update();
|
||||
}
|
||||
}
|
||||
|
||||
// 新系统驱动
|
||||
float dt = Time.deltaTime;
|
||||
for (int i = _activePlayers.Count - 1; i >= 0; i--)
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Cielonos.MainGame.Characters
|
||||
if (sourceItem != null)
|
||||
{
|
||||
sourceItem.audioContainer.PlaySoundFX("PerfectBlock");
|
||||
sourceItem.feedbackSc["PerfectBlock"]?.Play();
|
||||
sourceItem.feedbackSc.PlayFeedback("PerfectBlock");
|
||||
pObj = sourceItem.blockData.InstantiateBlockEffect(perfectEffectName, sourceCharacter, blockEffectPosition, Quaternion.identity);
|
||||
}
|
||||
else
|
||||
@@ -178,7 +178,7 @@ namespace Cielonos.MainGame.Characters
|
||||
if (sourceItem != null)
|
||||
{
|
||||
sourceItem.audioContainer.PlaySoundFX("NormalBlock");
|
||||
sourceItem.feedbackSc["NormalBlock"]?.Play();
|
||||
sourceItem.feedbackSc.PlayFeedback("NormalBlock");
|
||||
sourceItem.blockData.InstantiateBlockEffect(normalEffectName, sourceCharacter, blockEffectPosition, Quaternion.identity);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Cielonos.MainGame.Characters.Inventory;
|
||||
using MoreMountains.FeedbacksForThirdParty;
|
||||
using Sirenix.OdinInspector;
|
||||
using SLSUtilities.General;
|
||||
using UnityEngine;
|
||||
@@ -157,7 +156,7 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
if (sourceItem == null)
|
||||
{
|
||||
sourceCharacter?.feedbackSc["PerfectDodge"]?.Play();
|
||||
sourceCharacter?.feedbackSc.PlayFeedback("PerfectDodge");
|
||||
Debug.Log("Perfect Dodge!");
|
||||
}
|
||||
}
|
||||
@@ -168,7 +167,7 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
if (sourceItem == null)
|
||||
{
|
||||
sourceCharacter?.feedbackSc["NormalDodge"]?.Play();
|
||||
sourceCharacter?.feedbackSc.PlayFeedback("NormalDodge");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using MoreMountains.Feedbacks;
|
||||
using SLSUtilities.General;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user