Exemplo n.º 1
0
        //private static LoggerAdapter _logger = new LoggerAdapter(typeof(LadderState));

        public ExitLadderState(MovementStateId id) : base(id)
        {
            #region ladder to exitladder

            AddTransition(
                (command, addOutput) => FsmTransition.SimpleCommandHandler(command, FsmInput.ExitLadderFinished),
                null, (int)MovementStateId.Idle, null, 0, new[] { FsmInput.ExitLadderFinished });

            #endregion
        }
Exemplo n.º 2
0
        //private static LoggerAdapter _logger = new LoggerAdapter(typeof(LadderState));

        public EnterLadderState(MovementStateId id) : base(id)
        {
            #region enterladder to Ladder

            AddTransition(
                (command, addOutput) =>
            {
                if (command.IsMatch(FsmInput.EnterLadderFinished))
                {
                    return(true);
                }
                return(false);
            },
                (command, addOutput) => FsmTransitionResponseType.NoResponse,
                (int)MovementStateId.Ladder, null, 0, new[] { FsmInput.EnterLadderFinished });

            #endregion

            #region enterladder to exitladder

            AddTransition(
                (command, addOutput) =>
            {
                if (command.IsMatch(FsmInput.ExitLadder))
                {
                    FsmOutput.Cache.SetValue(AnimatorParametersHash.Instance.LadderHash,
                                             AnimatorParametersHash.Instance.LadderName,
                                             AnimatorParametersHash.Instance.LadderDisableValue,
                                             CharacterView.ThirdPerson, false);
                    addOutput(FsmOutput.Cache);

                    FsmOutput.Cache.SetValue(AnimatorParametersHash.Instance.LadderExitStateHash,
                                             AnimatorParametersHash.Instance.LadderExitStateName,
                                             (int)command.AdditioanlValue,
                                             CharacterView.ThirdPerson);
                    addOutput(FsmOutput.Cache);

                    FsmOutput.Cache.SetValue(AnimatorParametersHash.Instance.FreeFallHash,
                                             AnimatorParametersHash.Instance.FreeFallName,
                                             AnimatorParametersHash.Instance.FreeFallDisable,
                                             CharacterView.FirstPerson | CharacterView.ThirdPerson, false);
                    addOutput(FsmOutput.Cache);

                    command.Handled = true;
                    return(true);
                }

                return(false);
            },
                (command, addOutput) => FsmTransitionResponseType.NoResponse,
                (int)MovementStateId.ExitLadder, null, 0, new[] { FsmInput.ExitLadder });

            #endregion
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public MovementState(MovementStateId id) : base((short)id)
 {
 }
Exemplo n.º 5
0
        public MovementInConfig GetNextMovementState()
        {
            MovementStateId id = CurrentState.ActiveTransition == null ? (MovementStateId)CurrentState.StateId : (MovementStateId)CurrentState.ActiveTransition.To;

            return(StateIdAdapter.GetMovementStateId(id));
        }
Exemplo n.º 6
0
        public MovementInConfig GetCurrentMovementState()
        {
            MovementStateId id = (MovementStateId)CurrentState.StateId;

            return(StateIdAdapter.GetMovementStateId(id));
        }