JJBB/Assets/Project/Script/AnimatorFrameEvent.cs

56 lines
1.4 KiB
C#
Raw Permalink Normal View History

2024-08-23 15:49:34 +08:00
using UnityEngine;
using System.Collections;
using Games.AnimationModule;
public class AnimatorFrameEvent : MonoBehaviour {
private AnimationLogic m_animatorLogic = null;
void Start()
{
m_animatorLogic = GetComponentInParent<AnimationLogic>();
}
public void PlayRunSound()
{
GameManager.gameManager.SoundManager.PlaySoundEffect(12);
}
public void SetStateEnable(string state)
{
if (m_animatorLogic == null)
{
m_animatorLogic = GetComponentInParent<AnimationLogic>();
}
if (m_animatorLogic == null)
return;
m_animatorLogic.SetCurrAnimatorEnable(state);
}
public void SetStateDisable(string state)
{
if (m_animatorLogic == null)
m_animatorLogic = GetComponentInParent<AnimationLogic>();
if (m_animatorLogic != null)
m_animatorLogic.SetCurrAnimatorEnable(state, false);
}
public void AnimatorOver(int index)
{
if (m_animatorLogic == null)
{
m_animatorLogic = GetComponentInParent<AnimationLogic>();
}
if (m_animatorLogic == null)
return;
}
public void StartEffect(int effectId)
{
if (m_animatorLogic == null)
m_animatorLogic = GetComponentInParent<AnimationLogic>();
if (m_animatorLogic != null)
m_animatorLogic.StartEffect(effectId);
}
}