chunk 1: core gameplay scripts scenes runtime assets

This commit is contained in:
2026-04-06 11:02:34 +03:00
parent fa0388bc79
commit 0d11a097d8
703 changed files with 2292651 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
using UnityEngine;
namespace SpecialMoveCards
{
/// <summary>
/// Decouples PlayerPocket from AnimationManager or direct Animator usage.
/// Prefers AnimationManager if present, else falls back to Animator trigger/state.
/// </summary>
[RequireComponent(typeof(Animator))]
public class SpecialAnimationBridge : MonoBehaviour
{
private AnimationManager animManager; // existing class in project
private Animator animator;
private void Awake()
{
animator = GetComponent<Animator>();
animManager = GetComponent<AnimationManager>();
}
/// <summary>
/// Play a special move by animation trigger/state name.
/// </summary>
public void PlaySpecialMove(string triggerOrState)
{
if (string.IsNullOrEmpty(triggerOrState))
{
Debug.LogWarning("PlaySpecialMove called with empty name");
return;
}
if (animManager != null)
{
// AnimationManager will CrossFade by clip/state name
animManager.PlayAnimation(triggerOrState);
return;
}
// Fallback: try to SetTrigger if such a parameter exists. Else CrossFade.
if (animator == null) return;
int paramCount = animator.parameterCount;
bool hasTrigger = false;
for (int i = 0; i < paramCount; i++)
{
var p = animator.GetParameter(i);
if (p.type == AnimatorControllerParameterType.Trigger && p.name == triggerOrState)
{
hasTrigger = true;
break;
}
}
if (hasTrigger)
animator.SetTrigger(triggerOrState);
else
animator.CrossFade(triggerOrState, 0.1f, 0, 0);
}
}
}