void EndFightAni() { this.currentFightMove = FightMoves.None; this.canCombo = true; this.comboNum = 0; this.fightAni = null; }
void DoAttack(ScriptAniJob job, FightMoves move, int fwdCombo = 0) { if (job == null) { return; } if (!ModelInst.TryGetAniFromJob(job, out ScriptAni ani)) { return; } // combo window if (!ani.TryGetSpecialFrame(SpecialFrame.Combo, out float comboFrame)) { comboFrame = ani.EndFrame; } var comboPair = new Animations.FrameActionPair(comboFrame, () => OpenCombo()); // hit frame if (!ani.TryGetSpecialFrame(SpecialFrame.Hit, out float hitFrame)) { hitFrame = comboFrame; } if (hitFrame > comboFrame) { hitFrame = comboFrame; } var hitPair = new Animations.FrameActionPair(hitFrame, () => this.CalcHit()); // end of animation var endPair = Animations.FrameActionPair.OnEnd(() => EndFightAni()); // start ani first, because the OnEnd-Callback from the former attack resets the fight stance this.fightAni = this.ModelInst.StartAniJob(job, comboPair, hitPair, endPair); this.currentFightMove = move; this.canCombo = false; this.comboNum = fwdCombo; }
void DoDodge(ScriptAniJob job) { if (job == null) { return; } if (!ModelInst.TryGetAniFromJob(job, out ScriptAni ani)) { return; } // end of animation var endPair = Animations.FrameActionPair.OnEnd(() => EndFightAni()); this.fightAni = this.ModelInst.StartAniJob(job, endPair); this.currentFightMove = FightMoves.Dodge; this.canCombo = false; this.comboNum = 0; }