Ejemplo n.º 1
0
 public CharController_Direct(int id, int side, IJoyInput input)
 {
     this.idCare     = id;
     idSide          = side;
     bCareCharEvent  = true;
     bCareFightEvent = true;
     this.joy        = input;
 }
Ejemplo n.º 2
0
        public FightFSM(IGraphChar player, ILogicCharDriver charLogic, StateTable table, AI_StateTable aiStateTable, TreeStateConfig stateTree, IJoyInput joy)
        {
            this.aniPlayer    = player;
            this.charLogic    = charLogic;
            this.stateTable   = table;
            this.aiStateTable = aiStateTable;

            InitBlockParserMap();
            //StateItem 存储指令
            mapState = new Dictionary <string, StateItem>();
            foreach (var s in stateTable.allStates)
            {
                mapState[s.name] = s;
            }

            this.joy = joy;
            this.fps = aniPlayer.fps;
            ChangeBlock("stand", 0);
            mapBackState = new Dictionary <string, string>();
            if (stateTree == null)
            {
                return;
            }
            foreach (var state in stateTree.states)
            {
                if (mapState.ContainsKey(state.name))
                {
                    mapBackState[state.name] = state.name;//自己就有
                    continue;
                }
                else
                {
                    var node = stateTree.GetNode(state.name);
                    while (node != null)
                    {
                        if (mapState.ContainsKey(node.name))
                        {
                            break;
                        }
                        node = node.parent;
                    }
                    if (node == null)
                    {
                        throw new Exception("无效状态:" + state.name);
                    }
                    mapBackState[state.name] = node.name;//找到上层
                }
            }
            //player.set
        }