示例#1
0
        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));
        }
示例#2
0
        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));
        }
示例#3
0
        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));
        }
示例#4
0
 private int GetFacing(SpriteSequence spriteFrameSet, float rotation)
 {
     return(GetFacing(spriteFrameSet.Facings, rotation));
 }