Inheritance: MonoBehaviour
 void OnEnable()
 {
     animatorEvents          = target as AnimatorEvents;
     animatorEvents.animator = animatorEvents.gameObject.GetComponent <Animator>();
     if (animatorEvents.CheckRedudancy())
     {
         return;
     }
 }
示例#2
0
    void Awake()
    {
        _anim = GetComponent <Animator>();

        guiManager = GameObject.FindGameObjectWithTag(Tags.gui).GetComponent <GUIManager>();

        //control events for current animator
        _animatorEvents = GetComponent <AnimatorEvents>();
        gameController  = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();
        testMultiplayer = GameObject.Find("Multiplayer Manager");
    }
    public bool CheckRedudancy()
    {
        AnimatorEvents exisitingAnimatorEvents = GetComponent <AnimatorEvents>();

        if (exisitingAnimatorEvents != this && exisitingAnimatorEvents != null)
        {
            Debug.LogError("There can be only one AnimatorEvents per Animator");
            DestroyImmediate(this);
            return(true);
        }
        return(false);
    }
 void OnEnable()
 {
     animatorEvents = target as AnimatorEvents;
     animatorEvents.animator = animatorEvents.gameObject.GetComponent<Animator>();
     if (animatorEvents.CheckRedudancy())
         return;
 }
示例#5
0
 private void Start()
 {
     anim       = GetComponent <Animator>();
     animEvents = GetComponent <AnimatorEvents>();
 }