// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { controller = animator.GetComponent <EnemyControllerBB>(); if (animator.GetComponentInChildren <SpriteRenderer>().isVisible) { SoundManager.instance.PlayEffect(clip); } }
private void Start() { if (!isPlayer) { controller = this.GetComponent <EnemyControllerBB>(); } else { controllerP = this.GetComponent <PlayerControllerBB>(); } GameManagerActions.current.defeatEvent.AddListener(DisableOnPlayerDeath); }