Add A3DCombinedAction logic

This commit is contained in:
Chomper9981
2026-04-16 15:30:52 +07:00
parent 8e9360180f
commit 97bb1f97d4
26 changed files with 117494 additions and 167 deletions
+33 -88
View File
@@ -11,6 +11,7 @@ namespace BrewMonster
{
public string AnimationName;
public bool IsForceStopPrevious;
public CECAttackEvent AttackEvent;
}
public class PlayerVisual : MonoBehaviour
{
@@ -35,11 +36,17 @@ namespace BrewMonster
//when this trigger, clear all the animation in the queue which in the same layer of animancer
if (_animationQueue.Count > 0)
{
_animationQueue.Enqueue(new AnimationQueue { AnimationName = @event.AnimationName, IsForceStopPrevious = @event.IsForceStopPrevious });
_animationQueue.Enqueue(new AnimationQueue
{
AnimationName = @event.AnimationName,
IsForceStopPrevious = @event.IsForceStopPrevious,
AttackEvent = @event.AttackEvent
});
_animationList = _animationQueue.Select(q => q.AnimationName).ToList();
return;
}
InternalPlayAnimation(@event.AnimationName, @event.ITransTime);
ApplyAttackSignalOnAnimationEnd(@event.AttackEvent);
}
public void InitPlayerEventDoneHandler()
{
@@ -126,7 +133,12 @@ namespace BrewMonster
public bool EnqueueAnimation(QueueActionEvent @event)
{
if (namedAnimancer == null) return false;
_animationQueue.Enqueue(new AnimationQueue { AnimationName = @event.AnimationName, IsForceStopPrevious = @event.IsForceStopPrevious });
_animationQueue.Enqueue(new AnimationQueue
{
AnimationName = @event.AnimationName,
IsForceStopPrevious = @event.IsForceStopPrevious,
AttackEvent = null
});
_animationList = _animationQueue.Select(q => q.AnimationName).ToList();
if (!isHit)
@@ -163,6 +175,19 @@ namespace BrewMonster
var animationQueue = _animationQueue.Dequeue();
_animationList = _animationQueue.Select(q => q.AnimationName).ToList();
InternalPlayAnimation(animationQueue.AnimationName);
ApplyAttackSignalOnAnimationEnd(animationQueue.AttackEvent);
}
private void ApplyAttackSignalOnAnimationEnd(CECAttackEvent attackEvent)
{
if (attackEvent == null || _currentState == null)
{
return;
}
_currentState.Events.OnEnd = () =>
{
attackEvent.m_bSignaled = true;
};
}
void ApplyDamage()
{
@@ -189,97 +214,17 @@ namespace BrewMonster
/// <param name="fadeMode"></param>
private void InternalPlayAnimation(string animationName, float duration = FadeTime, FadeMode fadeMode = FadeMode)
{
//Debug.Log($"InternalPlayAnimation: animationName FUllNAME={animationName}");
string fullName = animationName;
string removeShapeName = animationName;
string removeFlyName = animationName;
if(animationName.Contains("_"))
{
int underscoreIndex = animationName.IndexOf('_');
removeShapeName = animationName.Substring(underscoreIndex + 1);
}
bool isState = namedAnimancer.States.TryGet(removeShapeName, out var existingState) ? true : false;
bool isState = namedAnimancer.States.TryGet(animationName, out var existingState) ? true : false;
if (isState)
{
_currentState = namedAnimancer.TryPlay(removeShapeName, duration / 1000, fadeMode);
_currentAnimationName = removeShapeName;
_currentState = namedAnimancer.TryPlay(animationName, duration / 1000, fadeMode);
_currentAnimationName = animationName;
//Debug.Log($"InternalPlayAnimation: removeShapeName 1 TriggerName={removeShapeName}");
return;
}
bool isState2 = namedAnimancer.States.TryGet(fullName, out var existingState2) ? true : false;
if (isState2)
{
_currentState = namedAnimancer.TryPlay(fullName, duration / 1000, fadeMode);
_currentAnimationName = fullName;
return;
}
string fullName2 = fullName;
//if contain 空拳 change it to 通用 apply to full name and removeShapeName
if (fullName2.Contains("空拳"))
{
fullName2 = fullName2.Replace("空拳", "通用");
removeShapeName = removeShapeName.Replace("空拳", "通用");
}
bool isState3 = namedAnimancer.States.TryGet(removeShapeName, out var existingState3) ? true : false;
if (isState3)
{
_currentState = namedAnimancer.TryPlay(removeShapeName, duration / 1000, fadeMode);
_currentAnimationName = removeShapeName;
return;
}
bool isState4 = namedAnimancer.States.TryGet(fullName2, out var existingState4) ? true : false;
if (isState4)
{
_currentState = namedAnimancer.TryPlay(fullName2, duration / 1000, fadeMode);
_currentAnimationName = fullName2;
return;
}
int index = removeShapeName.IndexOf("空中");
if (index >= 0 && removeShapeName.Length >= index + 4)
{
removeFlyName = removeShapeName.Remove(index + 2, 2);
}
else
{
removeFlyName = removeShapeName;
}
bool isState5 = namedAnimancer.States.TryGet(removeFlyName, out var existingState5) ? true : false;
if (isState5)
{
_currentState = namedAnimancer.TryPlay(removeFlyName, duration / 1000, fadeMode);
_currentAnimationName = removeFlyName;
return;
}
if (fullName2.Contains("_通用"))
{
fullName2 = fullName2.Replace("_通用", "");
removeShapeName = removeShapeName.Replace("_通用", "");
removeFlyName = removeFlyName.Replace("_通用", "");
}
bool isState6 = namedAnimancer.States.TryGet(fullName2, out var existingState6) ? true : false;
if (isState6)
{
_currentState = namedAnimancer.TryPlay(fullName2, duration / 1000, fadeMode);
_currentAnimationName = fullName2;
return;
}
bool isState8 = namedAnimancer.States.TryGet(removeShapeName, out var existingState8) ? true : false;
if (isState8)
{
_currentState = namedAnimancer.TryPlay(removeShapeName, duration / 1000, fadeMode);
_currentAnimationName = removeShapeName;
return;
}
bool isState7 = namedAnimancer.States.TryGet(removeFlyName, out var existingState7) ? true : false;
if (isState7)
{
_currentState = namedAnimancer.TryPlay(removeFlyName, duration / 1000, fadeMode);
_currentAnimationName = removeFlyName;
return;
}
BMLogger.LogError($"Null name animation: {fullName}");
BMLogger.LogError($"Null name animation: {animationName}");
}
/// <summary>