// 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) { base.OnStateEnter(animator, stateInfo, layerIndex); NPCScriptRef.FlipEnemy(); NPCScriptRef.SetIdle(); if (NPCScriptRef.m_health > 0) { NPCScriptRef.IdleDelay(); } }
// 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) { base.OnStateEnter(animator, stateInfo, layerIndex); if (NPCScriptRef.m_health <= 0) { NPCScriptRef.SetIdle(); NPC.GetComponent <CapsuleCollider2D> ().enabled = false; // disable triggers for attack and obstacle Transform[] childLayers = new Transform[NPC.transform.childCount]; for (int i = 0; i < childLayers.Length; i++) { NPC.transform.GetChild(i).GetComponent <BoxCollider2D>().enabled = false; } animator.SetBool(EnemyAnimation.TransitionCoditions.Die, true); } }
// 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) { base.OnStateEnter(animator, stateInfo, layerIndex); NPCScriptRef.SetIdle(); }