private void Start() { // Listen for the animator's weapon switch event. RPGCharacterAnimatorEvents animatorEvents = animator.gameObject.GetComponent <RPGCharacterAnimatorEvents>(); animatorEvents.OnWeaponSwitch.AddListener(WeaponSwitch); // Hide all weapons when the swim action begins. Actions.IActionHandler swimHandler = rpgCharacterController.GetHandler("Swim"); swimHandler.AddStartListener(HideAllWeapons); }
private void OnTriggerEnter(Collider collide) { controller = collide.gameObject.GetComponent <RPGCharacterController>(); if (controller != null) { oldJumpHandler = controller.GetHandler("Jump"); controller.SetHandler("Jump", new SimpleActionHandler(() => { Debug.Log("Can't jump!"); controller.EndAction("Jump"); }, () => { })); } }