Exemple #1
0
        /// <summary>
        /// Puts the character on the ladder
        /// </summary>
        protected virtual void StartClimbing()
        {
            if (CurrentLadder.LadderPlatform != null)
            {
                if (AboveLadderPlatform() &&
                    (LowestLadder == HighestLadder))
                {
                    return;
                }
            }

            // we rotate our character if requested
            if (ForceRightFacing)
            {
                _character.Face(Character.FacingDirections.Right);
            }

            SetClimbingState();

            // we set collisions
            _controller.CollisionsOn();

            if ((_characterHandleWeapon != null) && (!_characterHandleWeapon.CanShootFromLadders))
            {
                _characterHandleWeapon.ForceStop();
            }

            if (CurrentLadder.CenterCharacterOnLadder)
            {
                _controller.SetTransformPosition(new Vector2(CurrentLadder.transform.position.x, _controller.transform.position.y));
            }
        }
Exemple #2
0
 /// <summary>
 /// When exiting the state we make sure we're not shooting anymore
 /// </summary>
 public override void OnExitState()
 {
     base.OnExitState();
     _characterHandleWeapon.ForceStop();
     _shooting = false;
 }