void UpdateStatePower(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){
AnimatorTransitionInfo info = animator.GetAnimatorTransitionInfo (layerIndex);
if (animator.GetNextAnimatorStateInfo(layerIndex).GetHashCode() == stateInfo.GetHashCode()) { //Entering the state
_power = info.normalizedTime;
}else if(animator.GetCurrentAnimatorStateInfo(layerIndex).GetHashCode() == stateInfo.GetHashCode()){ //Exiting the state
_power = (1-info.normalizedTime);
}
}