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);
    }
}