private static AnimationCancellableInfo ImportCancellable(GSPat.Animation animation, int mask) { var first = animation.Frames.FindIndex(f => (f.StateFlag & mask) != 0); if (first == -1) { return(null); } return(new AnimationCancellableInfo { StartFrom = animation.Frames.Take(first).Sum(f => f.DisplayTime) }); }
private static AnimationDamageInfo ImportDamageInfo(GSPat.Animation animation) { var atkIndex = animation.Frames.FindIndex(f => f.AttackBoxes != null && f.AttackBoxes.Count > 0); if (atkIndex == -1) { return(null); } var atk = animation.Frames[atkIndex]; return(new AnimationDamageInfo() { AttackType = ImportAttackTypeEnum(atk.AttackType), BaseDamage = atk.Damage, HitStop = new HitStop { Self = atk.HitstopSelf, Opponent = atk.HitstopOpponent }, Knockback = new HitKnockback { SpeedX = atk.HitVX, SpeedY = atk.HitVY, Gravity = atk.HitG }, SoundEffect = atk.HitSoundEffect, }); }
public static AnimationSegment ImportSegment(Pat.Project proj, GSPat.GSPatFile pat, GSPat.Animation animation) { return(new AnimationSegment() { Damage = ImportDamageInfo(animation), CancelLevel = ImportCancelLevelEnum(animation.CancelLevel), IsLoop = animation.IsLoop, JumpCancellable = ImportCancellable(animation, 0x200000), SkillCancellable = ImportCancellable(animation, 0x20), Frames = animation.Frames.Select(f => ImportFrame(proj, pat, f)).ToList(), }); }