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