// OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { sirSheppardRigidBody.velocity = new Vector2(0, sirSheppardRigidBody.velocity.y); sirSheppardRigidBody.constraints = RigidbodyConstraints2D.FreezePositionX | RigidbodyConstraints2D.FreezeRotation; stateManager.setForceRight(false); stateMachine.ResetTrigger("newRoom"); }
// 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) { stateMachine = animator; sirSheppard = animator.gameObject.transform.parent.gameObject; stateManager = sirSheppard.GetComponent <SirSheppardStateManager>(); sirSheppardRigidBody = sirSheppard.GetComponent <Rigidbody2D>(); sirSheppardRigidBody.constraints = RigidbodyConstraints2D.FreezeRotation; stateManager.setForceRight(true); }