Пример #1
0
        void PlayAnim(TransitDir dir, bool jump = false)
        {
            int target = 0;

            switch (dir)
            {
            case TransitDir.moveHorizontal:
                target = 5;
                break;

            case TransitDir.moveVertical:
                target = 6;
                break;

            case TransitDir.jumpUp:
                target = 0;
                break;

            case TransitDir.jumpDown:
                target = 1;
                break;

            case TransitDir.jumpLeft:
                target = 3;
                break;

            case TransitDir.jumpRight:
                target = 2;
                break;
            }

            _anim.SetInteger("JumpType", target);

            if (!jump)
            {
                _anim.SetBool("Move", true);
            }
            else
            {
                _anim.SetBool("Jump", true);
            }
        }
Пример #2
0
        void UpdateconnectionTransitByType(Neighbour n, Vector3 inputDirection)
        {
            var desiredPosition = Vector3.zero;

            curConnection = n.cType;

            Vector3 direction = _targetPoint.transform.position - _curPoint.transform.position;

            direction.Normalize();

            switch (n.cType)
            {
            case ConnectionType.inBetween:

                var dist = Vector3.Distance(_curPoint.transform.position, _targetPoint.transform.position);
                desiredPosition = _curPoint.transform.position + (direction * (dist / 2));
                _targetState    = ClimbState.betweenPoints;
                TransitDir transitDir = TransitDirection(inputDirection, false);
                PlayAnim(transitDir);
                break;

            case ConnectionType.direct:

                desiredPosition = _targetPoint.transform.position;
                _targetState    = ClimbState.onPoint;
                transitDir      = TransitDirection(direction, false);
                Debug.Log(transitDir.ToString());
                PlayAnim(transitDir);
                break;

            case ConnectionType.dismount:

                desiredPosition = _targetPoint.transform.position;
                _anim.SetInteger("JumpType", 20);
                _anim.SetBool("Move", true);
                break;
            }

            _targetPosition = desiredPosition;
        }