-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
very basic ActionTweenProperty added
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
Assets/Plugins/GoKit/properties/genericTypes/ActionTweenProperty.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using UnityEngine; | ||
|
||
|
||
/// <summary> | ||
/// simple class that takes in an Action and calls it each tick with the eased value from startValue to endValue | ||
/// </summary> | ||
public class ActionTweenProperty : AbstractTweenProperty | ||
{ | ||
System.Action<float> _action; | ||
|
||
float _startValue; | ||
float _endValue; | ||
|
||
|
||
public ActionTweenProperty( System.Action<float> action, float startValue = 0, float endValue = 1 ) | ||
{ | ||
_action = action; | ||
_startValue = startValue; | ||
_endValue = endValue; | ||
} | ||
|
||
|
||
public override void prepareForUse() | ||
{} | ||
|
||
|
||
public override void tick( float totalElapsedTime ) | ||
{ | ||
var easedValue = _easeFunction( totalElapsedTime, _startValue, _endValue, _ownerTween.duration ); | ||
_action( easedValue ); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Plugins/GoKit/properties/genericTypes/ActionTweenProperty.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.