static void CreateAIStateConfig() { var obj = ScriptableObject.CreateInstance <FB.PosePlus.AniClip>(); string outpath = GetCreatePath(); FB.FFSM.AI_StateTable config = ScriptableObject.CreateInstance <FB.FFSM.AI_StateTable>(); AssetDatabase.CreateAsset(config, outpath); }
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 }
public Input_AI_Expand(Input_AI input, IBattleField battlefield, CharController_Direct _self, FB.FFSM.AI_StateTable table, AILevel aiLevel) { this.selfCC = _self; this.battlefield = battlefield; this.input = input; this.aiLevel = aiLevel; this.ai_table = table; //ai改变属性 AILevelChange(); vIdlePos = (battlefield as BattleField).GetRealChar(selfCC.idCare).transform.position; enemyCC = battlefield.GetAllCCBySide(1)[0] as CharController_Direct; //enemyCC.SetCCLife(0); stateTable = (battlefield as BattleField).GetRealChar(selfCC.idCare).transform.GetComponent <FB.FFSM.com_FightFSM>().stateTable; Start(); ChangeState(StateMachine.idle); ai_attackstate_map = new Dictionary <int, List <AI_StateItem> >(); for (int i = 0; i <= 3; i++) { ai_attackstate_map[i] = new List <AI_StateItem>();//0 移动系列 } if (ai_table == null || ai_table.allstates == null) { return; } foreach (var a in ai_table.allstates) { ai_attackstate_map[a.attacktype].Add(a); } }