public void SetAnim(MinionAnim anim, bool loop) { this.anim = anim; this.loop = loop; numFrames = anim.NumFrames(); curFrame = 0; elapsed = 0; dirty = true; }
public TaskTimed( Game game, string description, MinionAnim anim, Tool tool, float workAmt, Func <Vec2I, Vec2I> faceFn) : base(game, description) { this.faceFn = faceFn; this.anim = anim; this.tool = tool; this.workAmt = workAmt; }
public TaskTimedLambda( Game game, string description, MinionAnim anim, Tool tool, float workAmt, Func <Vec2I, Vec2I> faceFn, Func <TaskTimedLambda, float> workSpeedFn, Func <TaskTimedLambda, float, bool> workFn, Action <TaskTimedLambda> completeFn) : base(game, description, anim, tool, workAmt, faceFn) { BB.AssertNotNull(workSpeedFn); this.workSpeedFn = workSpeedFn; this.workFn = workFn; this.completeFn = completeFn; }
public Sprite GetSprite(string type, bool male, string name, MinionAnim anim, Dir dir, int frame) { if (type == "tabbard") { type = "torso"; } string path = "character/" + type + "/"; if (type != "weapon" && type != "arrow") { path += (male ? "male" : "female") + "/"; } path += name; return(atlases.Get(path).GetSprite(keys.Get(new AnimKey(anim, dir, frame)))); }
private static int OriginAnim(MinionAnim anim) { switch (anim) { case MinionAnim.Magic: return(0); case MinionAnim.Thrust: return(4); case MinionAnim.Idle: case MinionAnim.Walk: return(8); case MinionAnim.Slash: return(12); case MinionAnim.Reload: case MinionAnim.Shoot: return(16); case MinionAnim.Hurt: return(20); } throw new Exception("unknown anim: " + anim); }
public static int NumFrames(this MinionAnim anim) { switch (anim) { case MinionAnim.Idle: return(1); case MinionAnim.Magic: return(7); case MinionAnim.Thrust: return(8); case MinionAnim.Walk: return(9); case MinionAnim.Slash: return(6); case MinionAnim.Reload: return(1); case MinionAnim.Shoot: return(12); //that last frame sucks 13; case MinionAnim.Hurt: return(6); default: throw new ArgumentException($"Invalid Anim {anim}"); } }
public abstract void SetAnim(MinionAnim anim);
public override void SetAnim(MinionAnim anim) => skin.SetAnimLoop(anim);
public void PlayAnimOnce(MinionAnim anim) { state.SetAnim(anim, false); }
public void SetAnimLoop(MinionAnim anim) { // TODO: hackz state.SetAnim(anim, anim != MinionAnim.Shoot); }
public static float Duration(this MinionAnim anim) => anim.NumFrames() / 12f;
public AnimKey(MinionAnim anim, Dir dir, int frame) { this.anim = anim; this.dir = dir; this.frame = frame; }