TechbloxModdingAPI/GamecraftModdingAPI/Blocks/DampedSpring.cs
NorbiPeti a7f6a16231 Update to Gamecraft 2020.12.16.14.19 and custom block stuff
- Fixed the crash on second time start
- Tweaked more stuff about the block

Breaking changes coming from FMOD 2.0:
- Audio[int index] changed to Audio[PARAMETER_ID index]
- Audio.Parameters removed
2020-12-17 02:34:36 +01:00

48 lines
No EOL
1.4 KiB
C#

using RobocraftX.Blocks;
using RobocraftX.Common;
using Svelto.ECS;
namespace GamecraftModdingAPI.Blocks
{
public class DampedSpring : Block
{
public DampedSpring(EGID id) : base(id)
{
}
public DampedSpring(uint id) : base(new EGID(id, CommonExclusiveGroups.DAMPEDSPRING_BLOCK_GROUP))
{
}
/// <summary>
/// The spring's maximum force. This is known as Stiffness in-game
/// </summary>
public float MaxForce
{
get => BlockEngine.GetBlockInfo(this, (DampedSpringReadOnlyStruct dsrs) => dsrs.springFrequency);
set => BlockEngine.SetBlockInfo(this,
(ref DampedSpringReadOnlyStruct dsrs, float val) => dsrs.springFrequency = 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, (DampedSpringReadOnlyStruct ljf) => ljf.springDamping);
set => BlockEngine.SetBlockInfo(this,
(ref DampedSpringReadOnlyStruct ljf, float val) => ljf.springDamping = val, value);
}
}
}