/// <summary> /// On exit we stop force crouching /// </summary> /// <param name="collider"></param> protected virtual void OnTriggerExit(Collider collider) { _characterCrouch = collider.gameObject.MMGetComponentNoAlloc <Character>()?.FindAbility <CharacterCrouch>(); if (_characterCrouch != null) { _characterCrouch.StopForcedCrouch(); } }
/// <summary> /// On enter we force crouch if we can /// </summary> /// <param name="collider"></param> protected virtual void OnTriggerEnter(Collider collider) { _characterCrouch = collider.gameObject.MMGetComponentNoAlloc <CharacterCrouch>(); if (_characterCrouch != null) { _characterCrouch.StartForcedCrouch(); } }
/// <summary> /// Grabs dependencies /// </summary> protected override void Initialization() { _character = this.gameObject.GetComponent <Character>(); _characterCrouch = this.gameObject.GetComponent <CharacterCrouch>(); }
/// <summary> /// Grabs dependencies /// </summary> protected override void Initialization() { _character = this.gameObject.GetComponentInParent <Character>(); _characterCrouch = _character?.FindAbility <CharacterCrouch>(); }