Beispiel #1
0
 public void SetAnim(MinionAnim anim, bool loop)
 {
     this.anim = anim;
     this.loop = loop;
     numFrames = anim.NumFrames();
     curFrame  = 0;
     elapsed   = 0;
     dirty     = true;
 }
Beispiel #2
0
 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;
 }
Beispiel #3
0
 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;
 }
Beispiel #4
0
        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))));
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
        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}");
            }
        }
Beispiel #7
0
 public abstract void SetAnim(MinionAnim anim);
Beispiel #8
0
 public override void SetAnim(MinionAnim anim)
 => skin.SetAnimLoop(anim);
Beispiel #9
0
 public void PlayAnimOnce(MinionAnim anim)
 {
     state.SetAnim(anim, false);
 }
Beispiel #10
0
 public void SetAnimLoop(MinionAnim anim)
 {
     // TODO: hackz
     state.SetAnim(anim, anim != MinionAnim.Shoot);
 }
Beispiel #11
0
 public static float Duration(this MinionAnim anim)
 => anim.NumFrames() / 12f;
Beispiel #12
0
 public AnimKey(MinionAnim anim, Dir dir, int frame)
 {
     this.anim  = anim;
     this.dir   = dir;
     this.frame = frame;
 }