revorkAnimotor2

This commit is contained in:
Timofey06 2023-08-14 20:10:30 +03:00
parent 95e466fe74
commit 9eb6ae7113

View file

@ -8,7 +8,7 @@ using System.Text;
namespace DangerousD.GameCore.Graphics
{
public class GraphicsComponent
class GraphicsComponent
{
private List<AnimationContainer> animations;
private List<Texture2D> textures;
@ -75,13 +75,8 @@ namespace DangerousD.GameCore.Graphics
SetInterval();
}
public void DrawAnimation(Rectangle destinationRectangle, SpriteBatch _spriteBatch)
public void Update()
{
if (interval == 0)
{
currentFrame++;
@ -98,7 +93,9 @@ namespace DangerousD.GameCore.Graphics
}
interval--;
}
public void DrawAnimation(Rectangle destinationRectangle, SpriteBatch _spriteBatch)
{
_spriteBatch.Draw(textures[texturesNames.FindIndex(x => x == currentAnimation.TextureName)], destinationRectangle, sourceRectangle, Color.White);
}
private void buildSourceRectangle()