8
8
* Version : 0.1.0
9
9
* Date : 4/17/2018
10
10
* Description : Initial development version.
11
+ *
12
+ * Author : Mogoson
13
+ * Version : 0.1.0
14
+ * Date : 5/24/2018
15
+ * Description : Define mechanism interface.
11
16
*************************************************************************/
12
17
13
18
using System ;
16
21
namespace Mogoson . Machinery
17
22
{
18
23
/// <summary>
19
- /// Mechanism unit .
24
+ /// Mechanism interface .
20
25
/// </summary>
21
- [ Serializable ]
22
- public struct MechanismUnit
26
+ public interface IMechanism
23
27
{
24
- #region Field and Property
25
- /// <summary>
26
- /// Mechanism to drive.
27
- /// </summary>
28
- public Mechanism mechanism ;
29
-
30
28
/// <summary>
31
- /// Coefficient of velocity.
32
- /// </summary>
33
- public float coefficient ;
34
- #endregion
35
-
36
- #region Public Method
37
- /// <summary>
38
- /// Constructor.
29
+ /// Drive mechanism.
39
30
/// </summary>
40
- /// <param name="mechanism">Mechanism to drive.</param>
41
- /// <param name="coefficient">Coefficient of velocity.</param>
42
- public MechanismUnit ( Mechanism mechanism , float coefficient )
43
- {
44
- this . mechanism = mechanism ;
45
- this . coefficient = coefficient ;
46
- }
47
- #endregion
31
+ /// <param name="velocity">Drive velocity.</param>
32
+ void Drive ( float velocity ) ;
48
33
}
49
34
50
35
/// <summary>
51
36
/// Base mechanism.
52
37
/// </summary>
53
- public abstract class Mechanism : MonoBehaviour
38
+ public abstract class Mechanism : MonoBehaviour , IMechanism
54
39
{
55
40
#region Protected Method
56
41
protected virtual void Awake ( )
@@ -72,4 +57,36 @@ public virtual void Initialize() { }
72
57
public abstract void Drive ( float velocity ) ;
73
58
#endregion
74
59
}
60
+
61
+ /// <summary>
62
+ /// Mechanism unit.
63
+ /// </summary>
64
+ [ Serializable ]
65
+ public struct MechanismUnit
66
+ {
67
+ #region Field and Property
68
+ /// <summary>
69
+ /// Mechanism to drive.
70
+ /// </summary>
71
+ public Mechanism mechanism ;
72
+
73
+ /// <summary>
74
+ /// Coefficient of velocity.
75
+ /// </summary>
76
+ public float coefficient ;
77
+ #endregion
78
+
79
+ #region Public Method
80
+ /// <summary>
81
+ /// Constructor.
82
+ /// </summary>
83
+ /// <param name="mechanism">Mechanism to drive.</param>
84
+ /// <param name="coefficient">Coefficient of velocity.</param>
85
+ public MechanismUnit ( Mechanism mechanism , float coefficient )
86
+ {
87
+ this . mechanism = mechanism ;
88
+ this . coefficient = coefficient ;
89
+ }
90
+ #endregion
91
+ }
75
92
}
0 commit comments