diff --git a/Assets/MGS-CommonCode/Machinery/Mechanism.cs b/Assets/MGS-CommonCode/Machinery/Mechanism.cs index be80ffe..5da905e 100644 --- a/Assets/MGS-CommonCode/Machinery/Mechanism.cs +++ b/Assets/MGS-CommonCode/Machinery/Mechanism.cs @@ -8,6 +8,11 @@ * Version : 0.1.0 * Date : 4/17/2018 * Description : Initial development version. + * + * Author : Mogoson + * Version : 0.1.0 + * Date : 5/24/2018 + * Description : Define mechanism interface. *************************************************************************/ using System; @@ -16,41 +21,21 @@ namespace Mogoson.Machinery { /// - /// Mechanism unit. + /// Mechanism interface. /// - [Serializable] - public struct MechanismUnit + public interface IMechanism { - #region Field and Property - /// - /// Mechanism to drive. - /// - public Mechanism mechanism; - /// - /// Coefficient of velocity. - /// - public float coefficient; - #endregion - - #region Public Method - /// - /// Constructor. + /// Drive mechanism. /// - /// Mechanism to drive. - /// Coefficient of velocity. - public MechanismUnit(Mechanism mechanism, float coefficient) - { - this.mechanism = mechanism; - this.coefficient = coefficient; - } - #endregion + /// Drive velocity. + void Drive(float velocity); } /// /// Base mechanism. /// - public abstract class Mechanism : MonoBehaviour + public abstract class Mechanism : MonoBehaviour, IMechanism { #region Protected Method protected virtual void Awake() @@ -72,4 +57,36 @@ public virtual void Initialize() { } public abstract void Drive(float velocity); #endregion } + + /// + /// Mechanism unit. + /// + [Serializable] + public struct MechanismUnit + { + #region Field and Property + /// + /// Mechanism to drive. + /// + public Mechanism mechanism; + + /// + /// Coefficient of velocity. + /// + public float coefficient; + #endregion + + #region Public Method + /// + /// Constructor. + /// + /// Mechanism to drive. + /// Coefficient of velocity. + public MechanismUnit(Mechanism mechanism, float coefficient) + { + this.mechanism = mechanism; + this.coefficient = coefficient; + } + #endregion + } } \ No newline at end of file diff --git a/Assets/MGS-CommonCode/Machinery/Transmission.cs b/Assets/MGS-CommonCode/Machinery/Transmission.cs index 4ff5354..724584c 100644 --- a/Assets/MGS-CommonCode/Machinery/Transmission.cs +++ b/Assets/MGS-CommonCode/Machinery/Transmission.cs @@ -23,7 +23,7 @@ public class Transmission : Mechanism { #region Field and Property /// - /// Mechanism drive by this Transmission. + /// Mechanism drive by this transmission. /// public List mechanismUnits = new List(); #endregion