예제 #1
0
        void HandleClimbing()
        {
            if (!_lockInput)
            {
                float h = Input.GetAxis("Horizontal");
                float v = Input.GetAxis("Vertical");

                if (_climbState == ClimbState.onPoint)
                {
                    _ik.UpdateAllTargetPositions(_curPoint);
                    //_ik.ImmediatePlaceHelpers();
                }

                _inputDirection = ConvertToInputDirection(h, v);
                if (_inputDirection != Vector3.zero)
                {
                    switch (_climbState)
                    {
                    case ClimbState.onPoint:
                        OnPoint(_inputDirection);
                        break;

                    case ClimbState.betweenPoints:
                        BetweenPoints(_inputDirection);
                        break;
                    }
                }

                transform.parent = _curPoint.transform.parent;
            }
            else
            {
                InTransit(_inputDirection);
            }
        }
예제 #2
0
        void HandleClimbing()
        {
            if (!lockInput)
            {
                float hori  = input.goingRight;
                float verti = input.goingForward;

                inputDirection = ConvertToInputDirection(hori, verti);

                // Should be safe as ConvertToInputDirection handles floating point comparison already
                if (inputDirection != Vector3.zero)
                {
                    switch (climbState)
                    {
                    case ClimbStates.onPoint:
                        HandleOnPoint(inputDirection);
                        break;

                    case ClimbStates.betweenPoints:
                        HandleBetweenPoints(inputDirection);
                        break;
                    }
                }
                else
                {
                    switch (climbState)
                    {
                    case ClimbStates.betweenPoints:
                        inputDirection = previousPoint.ReturnNeighbor(targetPoint).direction;
                        HandleBetweenPoints(inputDirection);
                        break;
                    }
                }

                downBuffered = IsAdjacentToRefDirection(inputDirection, Vector3.down);

                // Temporary snap player to point for moving climbable objects
                transform.parent = currentPoint.transform.parent;

                if (climbState == ClimbStates.onPoint)
                {
                    ik.UpdateAllTargetPositions(currentPoint);
                    ik.ForceUpdateAllHelpers();
                }
            }
            else
            {
                InitTransition(inputDirection);
            }
        }