public void ChangeBlock(string statename, int blockindex) { if (statename.Equals("down_prone") || statename.Equals("down_lie") || statename.Equals("down")) { if (mapState[curStateName].bCanDeath == false) { Debug.LogError("该状态不能死亡!"); return; } } if (!string.IsNullOrEmpty(curStateName)) { if (curStateName.Equals("down_prone") || curStateName.Equals("down_lie") || curStateName.Equals("down")) { Debug.LogError("死亡状态不能切换!"); return; } } hitcount = 0; if (this.mapState.ContainsKey(statename) == false) { statename = mapBackState[statename]; // Debug.Log("BackState to:" + statename ); } if (this.mapState.ContainsKey(statename) == false) { throw new Exception("statename:" + statename + " block " + blockindex + "not found."); } if (this.mapState[statename].blocks == null || this.mapState[statename].blocks.Count <= blockindex) { throw new Exception("statename:" + statename + " block " + blockindex + "not found."); } curStateName = statename; curBlockIndex = blockindex; blockFrameBegin = aniPlayer.frameid; _curblock = this.mapState[statename].blocks[blockindex]; //IGraphChar 播放动画 aniPlayer.PlayAni(_curblock.playani, _curblock.playsubani, _curblock.playcross); //foreach (var func in _curblock.funcs) //{ // if (mapBlockParser.ContainsKey(func.classname.ToLower()) == false) // { // throw new Exception("do not have blockparser:" + statename + "," + blockindex + "," + func.classname); // } // if (mapBlockParser[func.classname.ToLower()].Init(this, func)) // break; //} for (int i = 0; i < listFuncCounter.Length; i++) { listFuncCounter[i] = -1; } if (charLogic != null) { charLogic.FE_Clear(); } }
void Init() { FB.FFSM.StateActionBlock block = Window_StateTable.selectBlock; if (block.blocktime == 0) { //将blocktime设置为动画长度 useClipCount(block, false); } }
//设置blocktime为动画长度 void useClipCount(FB.FFSM.StateActionBlock block, bool isConFirm) { if (Window_StateTable.aniPlayer == null) { EditorUtility.DisplayDialog("warning", "打开姿势不对,这个姿势无法取得aniPlayer", "滚开"); return; } var clip = Window_StateTable.aniPlayer.GetClip(block.playani); if (clip == null) { EditorUtility.DisplayDialog("warning", "hehe,动画就找不到,玩个蛋", "羞愧的滚开"); return; } else { int length = clip.frames.Count; if (string.IsNullOrEmpty(block.playsubani) == false) { var subclip = clip.GetSubClip(block.playsubani); if (subclip == null) { EditorUtility.DisplayDialog("warning", "hehe,子动画又找不到,玩个蛋", "羞愧的滚开X2"); return; } else { length = (int)subclip.endframe - (int)subclip.startframe + 1; } } if (isConFirm) { if (EditorUtility.DisplayDialog("warning", "确认修改", "然", "再想想")) { block.blocktime = length; SetAssetDirty(); return; } } else { block.blocktime = length; SetAssetDirty(); return; } } }
bool IsFuncChangeStatge() { //func 变招 if (selfCC.fightFSM.GetCurStateIndex == lasstStateIndex && selfCC.fightFSM.GetCurStateName.Equals(lastStateName) && selfCC.fightFSM.GetCurFrame == lastFramePass) { return(false); } //检查block 是否改变 if (!selfCC.fightFSM.GetCurStateName.Equals(lastStateName)) { lastStateName = selfCC.fightFSM.GetCurStateName; foreach (var s in stateTable.allStates) { if (s.name.Equals(lastStateName)) { stateItem = s; stateBlock = s.blocks[selfCC.fightFSM.GetCurStateIndex]; break; } } foreach (var f in stateBlock.funcs) { if (f.classname.Equals("inputexit")) { activeFrameBegin = f.activeFrameBegin; enterKey = f.strParam0; } else if (f.classname.Equals("repeatexit")) { activeFrameBegin = f.activeFrameBegin; enterKey = stateItem.conditions[0].cmdActive; } } } //检查blockIndex 是否改变 if (selfCC.fightFSM.GetCurStateIndex != lasstStateIndex) { lasstStateIndex = selfCC.fightFSM.GetCurStateIndex; stateBlock = stateItem.blocks[lasstStateIndex]; foreach (var f in stateBlock.funcs) { if (f.classname.Equals("inputexit")) { activeFrameBegin = f.activeFrameBegin; enterKey = f.strParam1; } else if (f.classname.Equals("repeatexit")) { activeFrameBegin = f.activeFrameBegin; enterKey = stateItem.conditions[0].cmdActive; } } } //检查frame 是否改变 if (selfCC.fightFSM.GetCurFrame != lastFramePass) { lastFramePass = selfCC.fightFSM.GetCurFrame; } if (string.IsNullOrEmpty(enterKey) || enterKey.Equals("")) { return(false); } if (lastFramePass >= activeFrameBegin) { return(true); } return(false); }