// OnStateExit is called before OnStateExit is called on any state inside this state machine override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (stateInfo.IsName("Leg F Kick")) { animator.SetBool("LegFKick", false); } else if (stateInfo.IsName("LowJump 1")) { animator.SetBool("LowJump", false); RootMotion.Demos.MechSpiderController ctl = animator.gameObject.GetComponent <RootMotion.Demos.MechSpiderController>(); if (ctl != null) { ctl.enabled = true; } RootMotion.Demos.MechSpider obj = animator.gameObject.GetComponent <RootMotion.Demos.MechSpider>(); if (obj != null) { foreach (RootMotion.Demos.MechSpiderLeg leg in obj.legs) { RootMotion.FinalIK.IK ik = leg.GetComponentInParent <RootMotion.FinalIK.IK>(); if (ik != null) { ik.enabled = true; } leg.enabled = true; } obj.enabled = true; animator.gameObject.transform.position = obj.body.position; } } else if (stateInfo.IsName("VictoryDance")) { animator.SetBool("VictoryDance", false); RootMotion.Demos.MechSpider obj = animator.gameObject.GetComponent <RootMotion.Demos.MechSpider>(); if (obj != null) { obj.enabled = true; } RootMotion.Demos.MechSpiderController ctl = animator.gameObject.GetComponent <RootMotion.Demos.MechSpiderController>(); if (ctl != null) { ctl.enabled = true; } } }
// OnStateEnter is called before OnStateEnter is called on any state inside this state machine override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { if (stateInfo.IsName("LowJump 1")) { RootMotion.Demos.MechSpider obj = animator.gameObject.GetComponent <RootMotion.Demos.MechSpider>(); if (obj != null) { obj.enabled = false; foreach (RootMotion.Demos.MechSpiderLeg leg in obj.legs) { leg.enabled = false; RootMotion.FinalIK.IK ik = leg.GetComponentInParent <RootMotion.FinalIK.IK>(); if (ik != null) { ik.enabled = false; } } } RootMotion.Demos.MechSpiderController ctl = animator.gameObject.GetComponent <RootMotion.Demos.MechSpiderController>(); if (ctl != null) { ctl.enabled = false; } } else if (stateInfo.IsName("VictoryDance")) { RootMotion.Demos.MechSpider obj = animator.gameObject.GetComponent <RootMotion.Demos.MechSpider>(); if (obj != null) { obj.enabled = false; } RootMotion.Demos.MechSpiderController ctl = animator.gameObject.GetComponent <RootMotion.Demos.MechSpiderController>(); if (ctl != null) { ctl.enabled = false; } } }