Example #1
0
 public SpeedManager(PlayerEntity player,
                     Contexts contexts,
                     ICharacterPosture posture,
                     ICharacterMovement movement,
                     ICharacterPostureInConfig postureInConfig,
                     ICharacterMovementInConfig movementInConfig,
                     ICharacterInfoProvider characterInfoProvider)
 {
     _contexts                 = contexts;
     _player                   = player;
     _posture                  = posture;
     _movement                 = movement;
     _postureInConfig          = postureInConfig;
     _movementInConfig         = movementInConfig;
     _characterInfoProvider    = characterInfoProvider;
     _speedConditionDictionary = new Dictionary <int, Action>()
     {
         // 落地
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Land, MovementInConfig.Null),
             () => { SetCurrentState(PostureInConfig.Null, MovementInConfig.Null); }
         },
         // 站立&静走
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Stand, MovementInConfig.Walk),
             () => { SetCurrentState(PostureInConfig.Stand, MovementInConfig.Walk); }
         },
         // 站立&跑步
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Stand, MovementInConfig.Run),
             () => { SetCurrentState(PostureInConfig.Stand, MovementInConfig.Run); }
         },
         // 站立&冲刺
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Stand, MovementInConfig.Sprint),
             () => { SetCurrentState(PostureInConfig.Stand, MovementInConfig.Sprint); }
         },
         // 蹲下&静走
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Crouch, MovementInConfig.Walk),
             () => { SetCurrentState(PostureInConfig.Crouch, MovementInConfig.Walk); }
         },
         // 蹲下&跑步
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Crouch, MovementInConfig.Run),
             () => { SetCurrentState(PostureInConfig.Crouch, MovementInConfig.Run); }
         },
         // 蹲下&冲刺
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Crouch, MovementInConfig.Sprint),
             () => { SetCurrentState(PostureInConfig.Crouch, MovementInConfig.Sprint); }
         },
         // 趴下&匍匐
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Prone, MovementInConfig.Null),
             () => { SetCurrentState(PostureInConfig.Prone, MovementInConfig.Walk); }
         },
         // 游泳
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Swim, MovementInConfig.Null),
             () => { SetCurrentState(PostureInConfig.Swim, MovementInConfig.Swim); }
         },
         // 潜水
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Dive, MovementInConfig.Null),
             () => { SetCurrentState(PostureInConfig.Dive, MovementInConfig.Dive); }
         },
         // 受伤
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Dying, MovementInConfig.Null),
             () => { SetCurrentState(PostureInConfig.Dying, MovementInConfig.Walk); }
         },
         // 受伤
         {
             CharacterStateConfigHelper.GenerateId(PostureInConfig.Null, MovementInConfig.Ladder),
             () => { SetCurrentState(PostureInConfig.Null, MovementInConfig.Ladder); }
         }
     };
 }