/// <summary> /// On Start() we reset our number of jumps /// </summary> protected override void Initialization() { base.Initialization(); ResetNumberOfJumps(); //_characterWallJump = GetComponent<CharacterWalljump>(); //_characterCrouch = GetComponent<CharacterCrouch>(); //_characterButtonActivation = GetComponent<CharacterButtonActivation>(); _characterHorizontalMovement = GetComponent <CharacterHorizontalMovement> (); _characterLadder = GetComponent <CharacterLadder>(); _characterShapeshift = GetComponent <CharacterShapeshift>(); }
/// <summary> /// Triggered when something collides with the ladder /// </summary> /// <param name="collider">Something colliding with the ladder.</param> protected virtual void OnTriggerEnter2D(Collider2D collider) { // we check that the object colliding with the ladder is actually a corgi controller and a character CharacterLadder characterLadder = collider.GetComponent <CharacterLadder>(); if (characterLadder == null) { return; } characterLadder.LadderColliding = true; characterLadder.CurrentLadder = this; }
/// <summary> /// Triggered when something exits the ladder /// </summary> /// <param name="collider">Something colliding with the ladder.</param> protected virtual void OnTriggerExit2D(Collider2D collider) { // we check that the object colliding with the ladder is actually a corgi controller and a character CharacterLadder characterLadder = collider.GetComponent <CharacterLadder>(); if (characterLadder == null) { return; } // when the character is not colliding with the ladder anymore, we reset its various ladder related states characterLadder.LadderColliding = false; characterLadder.CurrentLadder = null; }