play animation with fade time

This commit is contained in:
NguyenVanDat
2025-11-14 16:05:52 +07:00
parent 5eb6670b80
commit faaa843ef3
2 changed files with 11 additions and 4 deletions
@@ -2585,16 +2585,21 @@ MonoBehaviour:
- {fileID: 7400000, guid: 5f21aa4feb9cf1e49b63d5e7b7d9ad58, type: 2}
- {fileID: 7400000, guid: 4c93f18fe5082524d8ccda024f7988ad, type: 2}
- {fileID: 7400000, guid: bc909de03ae7dcc4d824253bf652de1d, type: 2}
- {fileID: 7400000, guid: 0f91f25e28e0f9e40b3775ae54c8f7da, type: 2}
- {fileID: 7400000, guid: 211cf985d64485e4ca42f7d8d6509e87, type: 2}
- {fileID: 7400000, guid: caa9485da71a78b4da087ae69bf7120d, type: 2}
- {fileID: 7400000, guid: 233ca05b3510f614e8b2ea31731dc298, type: 2}
- {fileID: 7400000, guid: 13d67a517390ab44ab7cd04a01241fa1, type: 2}
- {fileID: 7400000, guid: e45130cf176245344a417eb0ddb79826, type: 2}
- {fileID: 7400000, guid: 3e4c04d71f4e90041b63b23d8537a208, type: 2}
- {fileID: 7400000, guid: c2fb725802130e449a0636acf8b1815d, type: 2}
- {fileID: 7400000, guid: b8a2d2fdc3fbd5a4ca393badcb53bbea, type: 2}
- {fileID: 7400000, guid: b0ca22f0c2157aa46a778db01a1e5021, type: 2}
- {fileID: 7400000, guid: c2fb725802130e449a0636acf8b1815d, type: 2}
- {fileID: 7400000, guid: e8c5bb1084b86d2479538668547bc7bd, type: 2}
- {fileID: 7400000, guid: 3ab1241d6adeb0a4988632a06f8b8082, type: 2}
- {fileID: 7400000, guid: 30e08956cf9426044bf26fc108298874, type: 2}
- {fileID: 7400000, guid: 94e88f93d73c0384e912f9bdf56ca0f0, type: 2}
_searchingAnimation: "\u53D7\u4F24_\u901A\u7528"
--- !u!1 &2587141697474146175
GameObject:
m_ObjectHideFlags: 0
+5 -3
View File
@@ -17,11 +17,13 @@ public class PlayerVisual : MonoBehaviour
[SerializeField] private bool isHit;
[SerializeField] private int id;
private const float FadeTime = 0.3f;
private const FadeMode FadeMode = Animancer.FadeMode.FixedDuration;
QueueActionEvent queueActionEvent;
private void PlayActionEventHandler(PlayActionEvent @event)
{
_currentState = namedAnimancer.TryPlay(@event.AnimationName);
_currentState = namedAnimancer.TryPlay(@event.AnimationName, FadeTime, FadeMode);
if (_currentState == null)
{
BMLogger.LogError("HoangDev: PlayActionEventHandler Failed " + @event.AnimationName);
@@ -113,7 +115,7 @@ public class PlayerVisual : MonoBehaviour
ApplyDamage();
}
string animName = _animationQueue.Dequeue();
_currentState = namedAnimancer.TryPlay(animName);
_currentState = namedAnimancer.TryPlay(animName, FadeTime, FadeMode);
}
void ApplyDamage()