Пример #1
0
        public Sprite getCurrentSprite(TextureDefinition textureDefinition, GameTime gameTime)
        {
            float gameTotalSeconds = (float)gameTime.TotalGameTime.TotalSeconds;

            float spritesPerSecond = textureDefinition.GetSriteTotal();
            float second           = 1;

            float refreshRate = second / spritesPerSecond;
            float totalSecondsPerRefreshRate = gameTotalSeconds / refreshRate;

            int animationIndex = (int)Math.Round(totalSecondsPerRefreshRate) % 10;


            // CowboyStandingPistol.spriteList[1]
            string sprite = textureDefinition.GetSpriteIndex(animationIndex);



            return(SpriteSheetContainer(textureDefinition.GetContentFile()).GetSpriteByName(textureDefinition.GetSpriteIndex(animationIndex)));
        }
Пример #2
0
 public Sprite GetSpriteBasedOnTextureDefinitionAndIndex(TextureDefinition textureDefinition, int spriteIndex)
 {
     return(SpriteSheetContainer(textureDefinition.GetContentFile()).GetSpriteByName(textureDefinition.GetSpriteIndex(spriteIndex)));
 }