Release 1.9.7.0 - Summer Update 2025

This commit is contained in:
Regalis11
2025-06-17 16:38:11 +03:00
parent 22227f13e5
commit ea5a2bc693
297 changed files with 7344 additions and 2421 deletions

View File

@@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace Barotrauma
@@ -18,5 +19,15 @@ namespace Barotrauma
spriteBatch.Draw(texture, pos + offset, sourceRects[MathHelper.Clamp(spriteIndex, 0, sourceRects.Length - 1)], color, rotation + rotate, origin, scale, spriteEffect, depth == null ? this.depth : (float)depth);
}
/// <summary>
/// When this spritesheet is used for an animation, returns the current spriteIndex based on the given animation speed.
/// </summary>
/// <param name="animationSpeed">Animation speed in frames per second</param>
/// <param name="animatePaused">Should the animation run when paused? Defaults to false.</param>
public int GetAnimatedSpriteIndex(float animationSpeed, bool animatePaused = false)
{
return (int)(Math.Floor((animatePaused ? Timing.TotalTime : Timing.TotalTimeUnpaused) * animationSpeed) % FrameCount);
}
}
}