using UnityEngine; public class Actor : MonoBehaviour { private Animator animator; private void Awake() { // 自动获取 Animator 组件 animator = GetComponent(); if (animator == null) { Debug.LogError("Animator component not found on actor."); } } public void PlayAnimation(string animationName) { if (animator != null) { animator.Play(animationName); } else { Debug.LogError("Animator not found on actor."); } } public void InitializeAtSlot(Transform slot) { if (slot != null) { transform.position = slot.position; transform.rotation = slot.rotation; } else { Debug.LogError("Slot transform is null."); } } public void SetAnimationState(string stateName) { if (animator != null) { animator.SetTrigger(stateName); Debug.Log("Trigger"+stateName); } else { Debug.LogError("Animator not found on actor."); } } }