public int Cmd_CreateChar(string name, int side, MyJson.IJsonNode param) { //Debug.LogError("Cmd_CreateChar name= " + name); if (roleroot == null) { roleroot = GameObject.Find("role"); if (roleroot == null) { roleroot = new GameObject("role"); } } GameObject inst = null; if (world.extplayer != null) { inst = (world.extplayer as IResourceMgr).CreateChar(name); } else { inst = GameObject.Instantiate(Resources.Load <GameObject>(name)); } //if (reloadObjMap.ContainsKey(name)) //{ // inst = GameObject.Instantiate(reloadObjMap[name]); //} inst.SetActive(true); inst.transform.SetParent(roleroot.transform, true); freeid++; createChars[freeid] = new FB.FFSM.GraphChar_Driver(freeid, inst.transform, world, true); return(freeid); }
public void OnInit(IBattleField battleField) { this.battleField = battleField as BattleField; FB.FFSM.GraphChar_Driver ap = (battleField as BattleField).GetRealChar(idCare); var cc = ap.transform.GetComponent <FB.FFSM.com_FightFSM>(); logicchar = new LogicChar_Driver(battleField, idCare); foreach (var p in cc.defaultParam) { //Debug.LogError("p.name= " + p.name); //Debug.LogError("p.value= " + p.value); logicchar.SetParam(p.name, p.value); } graphchar = new GraphChar_Sender(battleField, idCare); //Charactor 脱离低级趣味 aniplayer = ap.transform.GetComponent <FB.PosePlus.AniPlayer>(); //fps = aniplayer.clips[0].fps; fightFSM = new FFSM.FightFSM(this.graphchar, this.logicchar, cc.stateTable, cc.aiStateTable, cc.stateTree, joy); if (joy is Input_AI) { (joy as Input_AI).Init(battleField, this, AiLevel); } }
public FB.FFSM.GraphChar_Driver GetRealChar(int id) { FB.FFSM.GraphChar_Driver obj = null; if (createChars.TryGetValue(id, out obj)) { return(obj); } else { return(null); } }
public GraphChar_Sender(IBattleField battleField, int id) { this.battleField = battleField; this.id = id; ap = (battleField as BattleField).GetRealChar(id); }