public SpriteFrame GetFrameForWall(string name, WallNeighbours wallNeighbours) { SpriteSequence spriteFrameSet = SpriteSequences.Where(s => s.Name == name).First(); int frame = (int)wallNeighbours; return(GetFrame(spriteFrameSet.Start + frame)); }
public SpriteFrame GetFrameForRotation(string name, float rotation) { SpriteSequence spriteFrameSet = SpriteSequences.Where(s => s.Name == name).First(); int facing = GetFacing(spriteFrameSet, rotation); int frame = spriteFrameSet.Start + (facing * spriteFrameSet.Length); return(GetFrame(frame)); }
public SpriteFrame GetFrameForAnimationAndRotation(string name, float rotation, int ticks, int frameRepeat = 8) { SpriteSequence spriteFrameSet = SpriteSequences.Where(s => s.Name == name).First(); int facing = GetFacing(spriteFrameSet, rotation); int startOfAnimation = spriteFrameSet.Start + (facing * spriteFrameSet.Length); int animationOffset = (ticks / frameRepeat) % spriteFrameSet.Length; int frame = startOfAnimation + animationOffset; return(GetFrame(frame)); }
private int GetFacing(SpriteSequence spriteFrameSet, float rotation) { return(GetFacing(spriteFrameSet.Facings, rotation)); }