using System;
using RobocraftX.Blocks;
using RobocraftX.Common;
using Svelto.ECS;
using Unity.Mathematics;
using GamecraftModdingAPI.Utility;
namespace GamecraftModdingAPI.Blocks
{
public class Servo : SignalingBlock
{
public Servo(EGID id) : base(id)
{
}
public Servo(uint id) : base(new EGID(id, CommonExclusiveGroups.SERVO_BLOCK_GROUP))
{
}
// custom servo properties
///
/// The servo's minimum angle.
///
public float MinimumAngle
{
get => BlockEngine.GetBlockInfo(this, (ServoReadOnlyStruct st) => st.minDeviation);
set
{
BlockEngine.SetBlockInfo(this, (ref ServoReadOnlyStruct st, float val) => st.minDeviation = val, value);
}
}
///
/// The servo's maximum angle.
///
public float MaximumAngle
{
get => BlockEngine.GetBlockInfo(this, (ServoReadOnlyStruct st) => st.maxDeviation);
set
{
BlockEngine.SetBlockInfo(this, (ref ServoReadOnlyStruct st, float val) => st.maxDeviation = val, value);
}
}
///
/// The servo's maximum force.
///
public float MaximumForce
{
get => BlockEngine.GetBlockInfo(this, (ServoReadOnlyStruct st) => st.servoVelocity);
set
{
BlockEngine.SetBlockInfo(this, (ref ServoReadOnlyStruct st, float val) => st.servoVelocity = val, value);
}
}
///
/// The servo's direction.
///
public bool Reverse
{
get => BlockEngine.GetBlockInfo(this, (ServoReadOnlyStruct st) => st.reverse);
set
{
BlockEngine.SetBlockInfo(this, (ref ServoReadOnlyStruct st, bool val) => st.reverse = val, value);
}
}
}
}