diff --git a/FTSources/FTRuntime/Sources/SwfClip.cs b/FTSources/FTRuntime/Sources/SwfClip.cs
index 52b7e23..9cfa5f2 100644
--- a/FTSources/FTRuntime/Sources/SwfClip.cs
+++ b/FTSources/FTRuntime/Sources/SwfClip.cs
@@ -20,7 +20,7 @@ namespace FTRuntime {
// ---------------------------------------------------------------------
[Header("Sorting")]
- [SerializeField][SwfSortingLayer]
+ [SerializeField, SwfSortingLayer]
string _sortingLayer = string.Empty;
[SerializeField]
int _sortingOrder = 0;
@@ -30,9 +30,9 @@ namespace FTRuntime {
Color _tint = Color.white;
[SerializeField]
SwfClipAsset _clip = null;
- [SerializeField][HideInInspector]
+ [SerializeField, HideInInspector]
string _sequence = string.Empty;
- [SerializeField][HideInInspector]
+ [SerializeField, HideInInspector]
int _currentFrame = 0;
// ---------------------------------------------------------------------
@@ -192,7 +192,7 @@ namespace FTRuntime {
//
// ---------------------------------------------------------------------
- public void Internal_LateUpdate() {
+ internal void Internal_LateUpdate() {
if ( _meshFilter && _meshRenderer && _dirtyMesh ) {
var baked_frame = GetCurrentBakedFrame();
if ( baked_frame != null ) {
@@ -206,6 +206,9 @@ namespace FTRuntime {
}
}
+ ///
+ /// Update all animation properties (for internal use only)
+ ///
public void Internal_UpdateAllProperties() {
ClearCache();
ChangeTint();
diff --git a/FTSources/FTRuntime/Sources/SwfClipController.cs b/FTSources/FTRuntime/Sources/SwfClipController.cs
index 034ad2e..d5ce16a 100644
--- a/FTSources/FTRuntime/Sources/SwfClipController.cs
+++ b/FTSources/FTRuntime/Sources/SwfClipController.cs
@@ -16,70 +16,141 @@ namespace FTRuntime {
//
// ---------------------------------------------------------------------
+ ///
+ /// Occurs when on stop playing event
+ ///
public event System.Action OnStopPlayingEvent;
+
+ ///
+ /// Occurs when on play stopped event
+ ///
public event System.Action OnPlayStoppedEvent;
+
+ ///
+ /// Occurs when on rewind playing event
+ ///
public event System.Action OnRewindPlayingEvent;
+ // ---------------------------------------------------------------------
+ //
+ // Serialized fields
+ //
+ // ---------------------------------------------------------------------
+
+ [SerializeField]
+ bool _autoPlay = false;
+
+ [SerializeField, SwfFloatRange(0.0f, float.MaxValue)]
+ float _rateScale = 1.0f;
+
+ [SerializeField]
+ string _groupName = string.Empty;
+
+ [SerializeField]
+ PlayModes _playMode = PlayModes.Forward;
+
+ [SerializeField]
+ LoopModes _loopMode = LoopModes.Once;
+
// ---------------------------------------------------------------------
//
// Properties
//
// ---------------------------------------------------------------------
+ ///
+ /// Controller play modes
+ ///
public enum PlayModes {
+ ///
+ /// Forward play mode
+ ///
Forward,
+ ///
+ /// Backward play mode
+ ///
Backward
}
+ ///
+ /// Controller loop modes
+ ///
public enum LoopModes {
+ ///
+ /// Once loop mode
+ ///
Once,
+ ///
+ /// Repeat loop mode
+ ///
Loop
}
- [SerializeField]
- bool _autoPlay = false;
+ ///
+ /// Gets or sets a value indicating whether controller play after awake on scene
+ ///
+ /// true if auto play; otherwise, false
public bool autoPlay {
get { return _autoPlay; }
set { _autoPlay = value; }
}
- [SerializeField]
- [SwfFloatRange(0.0f, float.MaxValue)]
- float _rateScale = 1.0f;
+ ///
+ /// Gets or sets the controller rate scale
+ ///
+ /// The rate scale
public float rateScale {
get { return _rateScale; }
set { _rateScale = Mathf.Clamp(value, 0.0f, float.MaxValue); }
}
- [SerializeField]
- string _groupName = string.Empty;
+ ///
+ /// Gets or sets the controller group name
+ ///
+ /// The group name
public string groupName {
get { return _groupName; }
set { _groupName = value; }
}
- [SerializeField]
- PlayModes _playMode = PlayModes.Forward;
+ ///
+ /// Gets or sets the controller play mode
+ ///
+ /// The play mode
public PlayModes playMode {
get { return _playMode; }
set { _playMode = value; }
}
- [SerializeField]
- LoopModes _loopMode = LoopModes.Once;
+ ///
+ /// Gets or sets the controller loop mode
+ ///
+ /// The loop mode
public LoopModes loopMode {
get { return _loopMode; }
set { _loopMode = value; }
}
+ ///
+ /// Gets the controller clip
+ ///
+ /// The clip
public SwfClip clip {
get { return _clip; }
}
+ ///
+ /// Gets a value indicating whether controller is playing
+ ///
+ /// true if is playing; otherwise, false
public bool isPlaying {
get { return _isPlaying; }
}
+ ///
+ /// Gets a value indicating whether controller is stopped
+ ///
+ /// true if is stopped; otherwise, false
public bool isStopped {
get { return !_isPlaying; }
}
@@ -90,6 +161,10 @@ namespace FTRuntime {
//
// ---------------------------------------------------------------------
+ ///
+ /// Changes the animation frame with stops it
+ ///
+ /// The new current frame
public void GotoAndStop(int frame) {
if ( clip ) {
clip.currentFrame = frame;
@@ -97,6 +172,11 @@ namespace FTRuntime {
Stop(false);
}
+ ///
+ /// Changes the animation sequence and frame with stops it
+ ///
+ /// The new sequence
+ /// The new current frame
public void GotoAndStop(string sequence, int frame) {
if ( clip ) {
clip.sequence = sequence;
@@ -104,10 +184,10 @@ namespace FTRuntime {
GotoAndStop(frame);
}
- //
- //
- //
-
+ ///
+ /// Changes the animation frame with plays it
+ ///
+ /// The new current frame
public void GotoAndPlay(int frame) {
if ( clip ) {
clip.currentFrame = frame;
@@ -115,6 +195,11 @@ namespace FTRuntime {
Play(false);
}
+ ///
+ /// Changes the animation sequence and frame with plays it
+ ///
+ /// The new sequence
+ /// The new current frame
public void GotoAndPlay(string sequence, int frame) {
if ( clip ) {
clip.sequence = sequence;
@@ -122,10 +207,10 @@ namespace FTRuntime {
GotoAndPlay(frame);
}
- //
- //
- //
-
+ ///
+ /// Stop with specified rewind action
+ ///
+ /// If set to true rewind animation to begin frame
public void Stop(bool rewind) {
var is_playing = isPlaying;
if ( is_playing ) {
@@ -140,6 +225,10 @@ namespace FTRuntime {
}
}
+ ///
+ /// Changes the animation sequence and stop controller with rewind
+ ///
+ /// The new sequence
public void Stop(string sequence) {
if ( clip ) {
clip.sequence = sequence;
@@ -147,10 +236,10 @@ namespace FTRuntime {
Stop(true);
}
- //
- //
- //
-
+ ///
+ /// Play with specified rewind action
+ ///
+ /// If set to true rewind animation to begin frame
public void Play(bool rewind) {
var is_stopped = isStopped;
if ( is_stopped ) {
@@ -165,6 +254,10 @@ namespace FTRuntime {
}
}
+ ///
+ /// Changes the animation sequence and play controller with rewind
+ ///
+ /// The new sequence
public void Play(string sequence) {
if ( clip ) {
clip.sequence = sequence;
@@ -172,10 +265,9 @@ namespace FTRuntime {
Play(true);
}
- //
- //
- //
-
+ ///
+ /// Rewind animation to begin frame
+ ///
public void Rewind() {
switch ( playMode ) {
case PlayModes.Forward:
@@ -204,7 +296,7 @@ namespace FTRuntime {
//
// ---------------------------------------------------------------------
- public void InternalUpdate(float dt) {
+ internal void Internal_Update(float dt) {
if ( isPlaying ) {
UpdateTimer(dt);
}
diff --git a/FTSources/FTRuntime/Sources/SwfManager.cs b/FTSources/FTRuntime/Sources/SwfManager.cs
index 6a21e05..2c1c8e6 100644
--- a/FTSources/FTRuntime/Sources/SwfManager.cs
+++ b/FTSources/FTRuntime/Sources/SwfManager.cs
@@ -230,10 +230,10 @@ namespace FTRuntime {
if ( ctrl ) {
var group_name = ctrl.groupName;
if ( string.IsNullOrEmpty(group_name) ) {
- ctrl.InternalUpdate(dt);
+ ctrl.Internal_Update(dt);
} else if ( IsGroupPlaying(group_name) ) {
var group_rate_scale = GetGroupRateScale(group_name);
- ctrl.InternalUpdate(group_rate_scale * dt);
+ ctrl.Internal_Update(group_rate_scale * dt);
}
}
}