public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { base.OnStateEnter(animator, stateInfo, layerIndex); //Make the entity reference if (m_pokeball == null) { m_pokeball = animator.gameObject.GetComponent <Pokeball>(); } //Search each state and compare the states array, if it find ones, then, notify foreach (var state in states) { if (Animator.StringToHash(state) == stateInfo.shortNameHash) //NameHash is the only way to identify the animator state { try { m_pokeball.ChangeState(state); //change the state, the entity will notify its state } catch (Exception e) { } } } }
protected override void ConfigEntity(GameObject entity) { lastPokeball = entity.GetComponent <Pokeball>(); lastPokeball.ConfigEntity(); handIsEmpty = false; }