using System; using RobocraftX.Blocks; using RobocraftX.Common; using Svelto.ECS; using Unity.Mathematics; using GamecraftModdingAPI.Utility; namespace GamecraftModdingAPI.Blocks { public class Motor : Block { public Motor(EGID id) : base(id) { } public Motor(uint id): base(new EGID(id, CommonExclusiveGroups.BUILD_MOTOR_BLOCK_GROUP)) { } // custom motor properties /// /// The motor's maximum rotational velocity. /// public float TopSpeed { get { return BlockEngine.GetBlockInfo(this, (MotorReadOnlyStruct st) => st.maxVelocity); } set { BlockEngine.SetBlockInfo(this, (ref MotorReadOnlyStruct st, float val) => st.maxVelocity = val, value); } } /// /// The motor's maximum rotational force. /// public float Torque { get { return BlockEngine.GetBlockInfo(this, (MotorReadOnlyStruct st) => st.maxForce); } set { BlockEngine.SetBlockInfo(this, (ref MotorReadOnlyStruct st, float val) => st.maxForce = val, value); } } /// /// The motor's direction. /// public bool Reverse { get { return BlockEngine.GetBlockInfo(this, (MotorReadOnlyStruct st) => st.reverse); } set { BlockEngine.SetBlockInfo(this, (ref MotorReadOnlyStruct st, bool val) => st.reverse = val, value); } } } }