예제 #1
0
 private void TryFilter(IFsmInputFilter filter, FilterState state)
 {
     filter.SetCurrentState(state);
     if (filter.Active)
     {
         filter.Filter(CommandsContainer);
     }
 }
예제 #2
0
 /// <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();
         }
     }
 }
예제 #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);
        }
예제 #4
0
 public void SetCurrentState(FilterState state)
 {
     Active = KeyState.IsEqual(state);
 }
예제 #5
0
 public bool IsEqual(FilterState rhs)
 {
     return(Posture == rhs.Posture);
 }