做不出来

This commit is contained in:
SoulliesOfficial
2026-06-30 01:48:58 -04:00
parent 9a9e48f8a5
commit ddd387ef35
132 changed files with 8945 additions and 2943 deletions

View File

@@ -16,12 +16,14 @@ namespace Cielonos.MainGame.Characters.AI
public string tagPrefix = "EnemyAttack";
private MusicBeatSystem _beatSystem;
private ILocalRhythmTracker _localTracker;
private BeatMarker _lastTriggeredBeat;
public override void OnAwake()
{
base.OnAwake();
_beatSystem = CombatManager.GetCombatSystem<MusicBeatSystem>();
_localTracker = gameObject.GetComponent<ILocalRhythmTracker>();
}
public override void OnStart()
@@ -31,12 +33,29 @@ namespace Cielonos.MainGame.Characters.AI
public override TaskStatus OnUpdate()
{
if (_beatSystem == null || !_beatSystem.IsActive || _beatSystem.CurrentBeatData == null)
MusicBeatData activeData = null;
float currentSongTime = 0f;
bool isActive = false;
if (_localTracker != null && _localTracker.CurrentBeatData != null)
{
activeData = _localTracker.CurrentBeatData;
currentSongTime = _localTracker.CurrentSongTime;
isActive = _localTracker.IsPlaying;
}
else if (_beatSystem != null && _beatSystem.IsActive && _beatSystem.CurrentBeatData != null)
{
activeData = _beatSystem.CurrentBeatData;
currentSongTime = _beatSystem.CurrentSongTime;
isActive = _beatSystem.IsPlaying;
}
if (!isActive || activeData == null)
{
return TaskStatus.Failure;
}
BeatMarker targetBeat = FindNextMatchingBeat();
BeatMarker targetBeat = FindNextMatchingBeat(activeData, currentSongTime);
if (targetBeat == null)
{
return TaskStatus.Failure;
@@ -48,7 +67,7 @@ namespace Cielonos.MainGame.Characters.AI
return TaskStatus.Failure;
}
float timeUntilBeat = targetBeat.time - _beatSystem.CurrentSongTime;
float timeUntilBeat = targetBeat.time - currentSongTime;
// Check if we are within the lead time window
if (timeUntilBeat <= leadTime)
@@ -60,10 +79,9 @@ namespace Cielonos.MainGame.Characters.AI
return TaskStatus.Failure;
}
private BeatMarker FindNextMatchingBeat()
private BeatMarker FindNextMatchingBeat(MusicBeatData activeData, float currentTime)
{
float currentTime = _beatSystem.CurrentSongTime;
var markers = _beatSystem.CurrentBeatData.beatMarkers;
var markers = activeData.beatMarkers;
if (markers == null) return null;