36 lines
1009 B
C#
36 lines
1009 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Sandbox.ModAPI.Ingame;
|
|
|
|
namespace IngameScript
|
|
{
|
|
partial class Program
|
|
{
|
|
public class BlockActionRotor : IBlockAction
|
|
{
|
|
private IMyMotorRotor _rotor;
|
|
private float _targetAngle;
|
|
private float _velocity = 5f;
|
|
private RotationDirection _direction = RotationDirection.AUTO;
|
|
|
|
public BlockActionRotor(
|
|
IMyMotorRotor rotor,
|
|
float targetAngle,
|
|
float velocity = 5f,
|
|
|
|
)
|
|
{
|
|
_rotor = rotor;
|
|
}
|
|
|
|
public IEnumerator<bool> Run()
|
|
{
|
|
// code to actually execute the action goes here
|
|
// any loops that wait for a condition to be true should
|
|
// `yield return true` inside the loop.
|
|
// If the action ends prematurely, use `yield break`
|
|
yield return true;
|
|
}
|
|
}
|
|
}
|
|
} |