Ejemplo n.º 1
0
        private EPlayerState MoveToState(MovementInConfig movement)
        {
            switch (movement)
            {
            case MovementInConfig.Walk:
                return(EPlayerState.Walk);

            case MovementInConfig.Sprint:
                return(EPlayerState.Sprint);

            case MovementInConfig.Run:
                return(EPlayerState.Run);

            case MovementInConfig.Injured:
                return(EPlayerState.Injured);

            case MovementInConfig.Swim:
                return(EPlayerState.Swim);

            case MovementInConfig.Dive:
                return(EPlayerState.Swim);

            case MovementInConfig.Ladder:
            case MovementInConfig.EnterLadder:
                return(EPlayerState.Ladder);

            default:
                return(EPlayerState.None);
            }
        }
Ejemplo n.º 2
0
 public static bool FilterPlayerIK(ActionInConfig action, ActionKeepInConfig keepAction, PostureInConfig posture,
                                   PostureInConfig nextPosture, MovementInConfig movement)
 {
     return(!(IsStateInActionFilter(action) ||
              IsStateInKeepActionFilter(keepAction) ||
              IsStateInPostureFilter(posture) ||
              IsStateInPostureFilter(nextPosture) ||
              IsStateInMovementFilter(movement)));
 }
Ejemplo n.º 3
0
        private float GetWeaponSpeed(PostureInConfig posture, MovementInConfig movement, float baseSpeed,
                                     float defaultSpeed)
        {
            var ret = defaultSpeed;
            var isInfluencedByWeapon = SingletonManager.Get <CharacterStateConfigManager>().IsInfluencedByWeapon(posture, movement);

            ret = isInfluencedByWeapon ? baseSpeed : defaultSpeed;
            return(ret);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 默认不受武器影响
        /// </summary>
        /// <param name="posture"></param>
        /// <param name="movement"></param>
        /// <returns></returns>
        public bool IsInfluencedByWeapon(PostureInConfig posture, MovementInConfig movement)
        {
            bool ret = false;
            int  id  = CharacterStateConfigHelper.GenerateId(posture, movement);

            if (_influencedByWeapon.ContainsKey(id))
            {
                ret = _influencedByWeapon[id] > 0;
            }

            return(ret);
        }
Ejemplo n.º 5
0
        private static bool IsStateInMovementFilter(MovementInConfig state)
        {
            for (var i = 0; i < _movementStateFilters.Length; ++i)
            {
                if (_movementStateFilters[i] == state)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 6
0
        internal static MovementInConfig GetMovementStateId(MovementStateId stateId)
        {
            MovementInConfig ret = MovementInConfig.Null;

            switch (stateId)
            {
            case MovementStateId.Idle:
                ret = MovementInConfig.Idle;
                break;

            case MovementStateId.Walk:
                ret = MovementInConfig.Walk;
                break;

            case MovementStateId.Run:
                ret = MovementInConfig.Run;
                break;

            case MovementStateId.Sprint:
                ret = MovementInConfig.Sprint;
                break;

            case MovementStateId.DiveMove:
                ret = MovementInConfig.DiveMove;
                break;

            case MovementStateId.EnterLadder:
            case MovementStateId.ExitLadder:
                ret = MovementInConfig.EnterLadder;
                break;

            case MovementStateId.Ladder:
                ret = MovementInConfig.Ladder;
                break;

            // 以下暂时没有用到
            //case MovementStateId.Swim:
            //    ret = MovementInConfig.Swim;
            //    break;
            //case MovementStateId.Dive:
            //    ret = MovementInConfig.Dive;
            //    break;
            //case MovementStateId.Injured:
            //    ret = MovementInConfig.Injured;
            //    break;
            default:
                ret = MovementInConfig.Null;
                break;
            }
            return(ret);
        }
Ejemplo n.º 7
0
        public float GetMovementTransitionSpeedScale(MovementInConfig stateOne, MovementInConfig stateTwo,
                                                     float normalizeTime, float targetTime)
        {
            int id = CharacterStateConfigHelper.GenerateId(stateOne, stateTwo);

            if (_movementTransitionSpeedScale.ContainsKey(id))
            {
                return((_movementTransitionSpeedScale[id].Evaluate(targetTime) - _movementTransitionSpeedScale[id].Evaluate(normalizeTime)) / (targetTime - normalizeTime));
            }
            else
            {
                return(1.0f);
            }
        }
Ejemplo n.º 8
0
        public int GetMovementTransitionTime(MovementInConfig stateOne, MovementInConfig stateTwo)
        {
            int id = CharacterStateConfigHelper.GenerateId(stateOne, stateTwo);

            if (_movementTransitionTime.ContainsKey(id))
            {
                return(_movementTransitionTime[id]);
            }
            else
            {
                Logger.WarnFormat("duration not defined for {0} to {1}", stateOne, stateTwo);
                return(DefaultTransitionTime);
            }
        }
Ejemplo n.º 9
0
        public float GetSpeed(PostureInConfig posture, MovementInConfig movement, bool isFront, bool isBack, bool isLeft, bool isRight, float standardSpeed)
        {
            float ret = 0;

            int id = CharacterStateConfigHelper.GenerateId(posture, movement);

            if (_coefficients.ContainsKey(id))
            {
                var v = isFront ? Vertical.Front : isBack ? Vertical.Back : Vertical.Neutral;
                var h = isLeft ? Horizontal.Left : isRight ? Horizontal.Right : Horizontal.Neutral;
                ret = _coefficients[id].CoefficientByDirection[(int)v, (int)h] * standardSpeed;
            }

            return(ret);
        }
Ejemplo n.º 10
0
        public static ThirdPersonMovement GetMovement(MovementInConfig movement)
        {
            ThirdPersonMovement ret;

            switch (movement)
            {
            case MovementInConfig.Sprint:
                ret = ThirdPersonMovement.Sprint;
                break;

            default:
                ret = ThirdPersonMovement.EndOfTheWorld;
                break;
            }

            return(ret);
        }
Ejemplo n.º 11
0
 private void SetCurrentState(PostureInConfig posture, MovementInConfig movement)
 {
     _currentPosture  = posture;
     _currentMovement = movement;
 }
Ejemplo n.º 12
0
 public static int GenerateId(MovementInConfig enumOne, MovementInConfig enumTwo)
 {
     return(((int)enumOne << 16) + (int)enumTwo);
 }
Ejemplo n.º 13
0
 private bool IsMovementLadder(MovementInConfig movement)
 {
     return(movement == MovementInConfig.Ladder ||
            movement == MovementInConfig.EnterLadder);
 }