/// <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>();
 }
Beispiel #2
0
 /// <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>();
     _characterLadder           = GetComponent <CharacterLadder>();
     _initialNumberOfJumps      = NumberOfJumps;
     CanJumpStop = true;
 }
        /// <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.gameObject.MMGetComponentNoAlloc <Character>()?.FindAbility <CharacterLadder>();

            if (characterLadder == null)
            {
                return;
            }
            characterLadder.RemoveCollidingLadder(_collider2D);
        }
 /// <summary>
 /// On Start() we reset our number of jumps
 /// </summary>
 protected override void Initialization()
 {
     base.Initialization();
     ResetNumberOfJumps();
     _characterWallJump         = _character?.FindAbility <CharacterWalljump>();
     _characterCrouch           = _character?.FindAbility <CharacterCrouch>();
     _characterButtonActivation = _character?.FindAbility <CharacterButtonActivation>();
     _characterLadder           = _character?.FindAbility <CharacterLadder>();
     _initialNumberOfJumps      = NumberOfJumps;
     CanJumpStop = true;
 }
Beispiel #5
0
        /// <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;
        }
Beispiel #6
0
        /// <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;
        }