public static string NormalizeSequence(Animation anim, DamageState state, string sequence) { var states = new Pair<DamageState, string>[] { Pair.New(DamageState.Critical, "critical-"), Pair.New(DamageState.Heavy, "damaged-"), Pair.New(DamageState.Medium, "scratched-"), Pair.New(DamageState.Light, "scuffed-") }; // Remove existing damage prefix foreach (var s in states) { if (sequence.StartsWith(s.Second)) { sequence = sequence.Substring(s.Second.Length); break; } } foreach (var s in states) if (state >= s.First && anim.HasSequence(s.Second + sequence)) return s.Second + sequence; return sequence; }
public GravityBomb(GravityBombInfo info, ProjectileArgs args) { Args = args; altitude = args.srcAltitude; anim = new Animation(info.Image); if (anim.HasSequence("open")) anim.PlayThen("open", () => anim.PlayRepeating("idle")); else anim.PlayRepeating("idle"); }
public static string NormalizeSequence(Animation anim, DamageState state, string sequence) { // Remove any existing damage prefix sequence = UnnormalizeSequence(sequence); foreach (var s in DamagePrefixes) if (state >= s.First && anim.HasSequence(s.Second + sequence)) return s.Second + sequence; return sequence; }
public GravityBomb(GravityBombInfo info, ProjectileArgs args) { this.info = info; this.args = args; pos = args.Source; velocity = new WVec(WRange.Zero, WRange.Zero, -info.Velocity); anim = new Animation(info.Image); if (anim.HasSequence("open")) anim.PlayThen("open", () => anim.PlayRepeating("idle")); else anim.PlayRepeating("idle"); }
public static string NormalizeSequence(Animation anim, DamageState state, string baseSequence) { var states = new Pair<DamageState, string>[] { Pair.New(DamageState.Critical, "critical-"), Pair.New(DamageState.Heavy, "damaged-"), Pair.New(DamageState.Medium, "scratched-"), Pair.New(DamageState.Light, "scuffed-") }; foreach (var s in states) if (state >= s.First && anim.HasSequence(s.Second+baseSequence)) return s.Second+baseSequence; return baseSequence; }
public Parachute(Player owner, string image, float2 location, int altitude, Actor cargo) { this.location = location; this.altitude = altitude; this.cargo = cargo; this.owner = owner; anim = new Animation(image); if (anim.HasSequence("idle")) anim.PlayFetchIndex("idle", () => 0); else anim.PlayFetchIndex("stand", () => 0); anim.Tick(); paraAnim = new Animation("parach"); paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle")); }
public Parachute(Player owner, float2 location, int altitude, Actor cargo) { this.location = location; this.altitude = altitude; this.cargo = cargo; var rs = cargo.Trait<RenderSimple>(); var image = rs.anim.Name; palette = rs.Palette(owner); anim = new Animation(image); if (anim.HasSequence("idle")) anim.PlayFetchIndex("idle", () => 0); else anim.PlayFetchIndex("stand", () => 0); anim.Tick(); paraAnim = new Animation("parach"); paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle")); }
public Parachute(Player owner, PPos location, int altitude, Actor cargo) { this.location = location; this.altitude = altitude; this.cargo = cargo; var rs = cargo.Trait<RenderSimple>(); var image = rs.anim.Name; palette = rs.Palette(owner); anim = new Animation(image); if (anim.HasSequence("idle")) anim.PlayFetchIndex("idle", () => 0); else anim.PlayFetchIndex("stand", () => 0); anim.Tick(); var pai = cargo.Info.Traits.GetOrDefault<ParachuteAttachmentInfo>(); paraAnim = new Animation(pai != null ? pai.ParachuteSprite : "parach"); paraAnim.PlayThen("open", () => paraAnim.PlayRepeating("idle")); if (pai != null) offset = pai.Offset; }