Roblox-File-Format/DataTypes/NumberSequenceKeypoint.cs

57 lines
1.4 KiB
C#
Raw Normal View History

namespace RobloxFiles.DataTypes
{
public class NumberSequenceKeypoint
{
public readonly float Time;
public readonly float Value;
public readonly float Envelope;
public override string ToString()
{
return $"{Time} {Value} {Envelope}";
}
public NumberSequenceKeypoint(float time, float value, float envelope = 0)
{
Time = time;
Value = value;
Envelope = envelope;
}
internal NumberSequenceKeypoint(Attribute attr)
{
Envelope = attr.readFloat();
Time = attr.readFloat();
Value = attr.readFloat();
}
2020-09-13 01:16:19 +00:00
public override int GetHashCode()
{
int hash = Time.GetHashCode()
^ Value.GetHashCode()
^ Envelope.GetHashCode();
return hash;
}
public override bool Equals(object obj)
{
if (!(obj is NumberSequenceKeypoint))
return false;
var otherKey = obj as NumberSequenceKeypoint;
if (!Time.Equals(otherKey.Time))
return false;
if (!Value.Equals(otherKey.Value))
return false;
if (!Envelope.Equals(otherKey.Envelope))
return false;
return true;
}
}
}