(3dc4135ce) v0.9.5.1
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
partial class ConditionalSprite
|
||||
{
|
||||
public void Remove()
|
||||
{
|
||||
Sprite?.Remove();
|
||||
Sprite = null;
|
||||
DeformableSprite?.Remove();
|
||||
DeformableSprite = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,8 +43,19 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private float rotationRadians;
|
||||
[Serialize(0.0f, true), Editable]
|
||||
public float Rotation { get; private set; }
|
||||
public float Rotation
|
||||
{
|
||||
get
|
||||
{
|
||||
return MathHelper.ToDegrees(rotationRadians);
|
||||
}
|
||||
private set
|
||||
{
|
||||
rotationRadians = MathHelper.ToRadians(value);
|
||||
}
|
||||
}
|
||||
|
||||
[Serialize(AnimationType.None, false), Editable]
|
||||
public AnimationType RotationAnim { get; private set; }
|
||||
@@ -118,16 +129,16 @@ namespace Barotrauma
|
||||
{
|
||||
if (rotationSpeedRadians <= 0.0f)
|
||||
{
|
||||
return Rotation;
|
||||
return rotationRadians;
|
||||
}
|
||||
switch (OffsetAnim)
|
||||
switch (RotationAnim)
|
||||
{
|
||||
case AnimationType.Sine:
|
||||
rotationState = rotationState % (MathHelper.TwoPi / rotationSpeedRadians);
|
||||
return Rotation * (float)Math.Sin(rotationState * rotationSpeedRadians);
|
||||
return rotationRadians * (float)Math.Sin(rotationState * rotationSpeedRadians);
|
||||
case AnimationType.Noise:
|
||||
rotationState = rotationState % (1.0f / rotationSpeedRadians);
|
||||
return Rotation * PerlinNoise.GetPerlin(rotationState * rotationSpeedRadians, rotationState * rotationSpeedRadians);
|
||||
return rotationRadians * (PerlinNoise.GetPerlin(rotationState * rotationSpeedRadians, rotationState * rotationSpeedRadians) - 0.5f);
|
||||
default:
|
||||
return rotationState * rotationSpeedRadians;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace Barotrauma.SpriteDeformations
|
||||
{
|
||||
class InflateParams : SpriteDeformationParams
|
||||
{
|
||||
[Serialize(0.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 100.0f)]
|
||||
[Serialize(0.0f, true), Editable(MinValueFloat = 0.0f, MaxValueFloat = 100.0f, DecimalCount = 2, ValueStep = 1)]
|
||||
public override float Frequency { get; set; } = 1;
|
||||
[Serialize(1.0f, true), Editable(MinValueFloat = 0.01f, MaxValueFloat = 10.0f)]
|
||||
[Serialize(1.0f, true), Editable(MinValueFloat = 0.01f, MaxValueFloat = 10.0f, DecimalCount = 2, ValueStep = 0.1f)]
|
||||
public float Scale { get; set; }
|
||||
|
||||
public InflateParams(XElement element) : base(element)
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Barotrauma.SpriteDeformations
|
||||
{
|
||||
class NoiseDeformationParams : SpriteDeformationParams
|
||||
{
|
||||
[Serialize(0.0f, true, description: "The frequency of the noise."), Editable(MinValueFloat = 0.0f, MaxValueFloat = 100.0f)]
|
||||
[Serialize(0.0f, true, description: "The frequency of the noise."), Editable(MinValueFloat = 0.0f, MaxValueFloat = 100.0f, DecimalCount = 2, ValueStep = 1f)]
|
||||
public override float Frequency { get; set; }
|
||||
|
||||
[Serialize(1.0f, true, description: "How much the noise distorts the sprite."), Editable(MinValueFloat = 0.0f, MaxValueFloat = 10.0f, DecimalCount = 2, ValueStep = 0.01f)]
|
||||
|
||||
Reference in New Issue
Block a user