TechbloxModdingAPI/GamecraftModdingAPI/Blocks/DampedSpring.cs

48 lines
1.4 KiB
C#
Raw Normal View History

2020-10-27 15:59:21 +00:00
using RobocraftX.Blocks;
using RobocraftX.Common;
using Svelto.ECS;
namespace GamecraftModdingAPI.Blocks
{
public class DampedSpring : Block
{
public DampedSpring(EGID id) : base(id)
{
}
2020-11-09 21:18:25 +00:00
public DampedSpring(uint id) : base(new EGID(id, CommonExclusiveGroups.DAMPEDSPRING_BLOCK_GROUP))
2020-10-27 15:59:21 +00:00
{
}
/// <summary>
/// The spring's maximum force. This is known as Stiffness in-game
/// </summary>
public float MaxForce
{
get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct dsrs) => dsrs.maxForce);
set => BlockEngine.SetBlockInfo(this,
(ref DampedSpringReadOnlyStruct dsrs, float val) => dsrs.maxForce = val, value);
}
/// <summary>
/// Alias of MaxForce.
/// </summary>
public float Stiffness
{
get => MaxForce;
set => MaxForce = value;
}
/// <summary>
/// The spring's maximum damping force.
/// </summary>
public float Damping
{
get => BlockEngine.GetBlockInfo(this, (LinearJointForcesReadOnlyStruct ljf) => ljf.dampingForceMagnitude);
set => BlockEngine.SetBlockInfo(this,
(ref LinearJointForcesReadOnlyStruct ljf, float val) => ljf.dampingForceMagnitude = val, value);
}
}
}