Class Cycle
Namespace : SpriteAnimations
Constructors
Cycle()
public Cycle()
Cycle(SpriteAnimation)
public Cycle(SpriteAnimation animation)
Parameters
animation
SpriteAnimation
Fields
_animation
[SerializeField]
protected SpriteAnimation _animation
Field Value
_frames
[SerializeField]
protected List<Frame> _frames
Field Value
_identifiable
[SerializeField]
protected bool _identifiable
Field Value
Properties
Animation
The animation wich this cycle belongs to
public SpriteAnimation Animation { get; set; }
Property Value
Frames
public List<Frame> Frames { get; }
Property Value
Identifiable
If the cycle can have identifiable frames
public bool Identifiable { get; set; }
Property Value
Size
The size of the cycle (number of frames)
public int Size { get; }
Property Value
Methods
AddFrame(Frame)
public void AddFrame(Frame frame)
Parameters
frame
Frame
AddFrame(Sprite)
public void AddFrame(Sprite sprite)
Parameters
sprite
Sprite
AddFrame(Sprite, string)
public void AddFrame(Sprite sprite, string id)
Parameters
sprite
Spriteid
string
CalculateDuration()
Calculate the total duration of the cycle based on the given FPS rate.
public float CalculateDuration()
Returns
- float
The duration of the sequence of frames.
EvaluateFrame(float)
Evaluates the frame based on the elapsed time.
public Frame EvaluateFrame(float elapsedTime)
Parameters
elapsedTime
floatThe elapsed time in seconds.
Returns
- Frame
The evaluated frame.
EvaluateIndexAndFrame(float)
Evaluates the frame at a given elapsed time.
public (int index, Frame frame) EvaluateIndexAndFrame(float elapsedTime)
Parameters
elapsedTime
floatThe elapsed time in seconds.
Returns
GetFirstFrame()
public Frame GetFirstFrame()
Returns
TryGetFrame(int, out Frame)
public bool TryGetFrame(int index, out Frame frame)