void OnEnable() { animatorEvents = target as AnimatorEvents; animatorEvents.animator = animatorEvents.gameObject.GetComponent <Animator>(); if (animatorEvents.CheckRedudancy()) { return; } }
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; }
private void Start() { anim = GetComponent <Animator>(); animEvents = GetComponent <AnimatorEvents>(); }