private void TryFilter(IFsmInputFilter filter, FilterState state)
 {
     filter.SetCurrentState(state);
     if (filter.Active)
     {
         filter.Filter(CommandsContainer);
     }
 }
 /// <summary>
 /// 一些命令只有在特定的状态下使用
 /// </summary>
 /// <param name="state"></param>
 private void BlockFilter(FilterState state)
 {
     for (int i = 0; i < CommandsContainer.Length; ++i)
     {
         if (FilterFsmInputByStateDict.ContainsKey(CommandsContainer[i].Type) && !FilterFsmInputByStateDict[CommandsContainer[i].Type].Contains(state.Posture, CommonEnumEqualityComparer <PostureInConfig> .Instance))
         {
             CommandsContainer[i].Reset();
         }
     }
 }
Beispiel #3
0
        public void CreateCommands(IUserCmd cmd, FilterState state, PlayerEntity player, Contexts contexts) //,int curLeanState,int leanTimeCount)
        {
            FromUserCmdToFsmInput(cmd, player, contexts);
            foreach (var v in _filters)
            {
                TryFilter(v, state);
            }

            BlockFilter(state);
        }
Beispiel #4
0
 public void SetCurrentState(FilterState state)
 {
     Active = KeyState.IsEqual(state);
 }
Beispiel #5
0
 public bool IsEqual(FilterState rhs)
 {
     return(Posture == rhs.Posture);
 }