Skip to content

Commit 0de26fe

Browse files
committed
Updated README.md and examples
1 parent e52596d commit 0de26fe

File tree

4 files changed

+75
-1
lines changed

4 files changed

+75
-1
lines changed

Assets/AdncAnimatorHelpers/Examples/Default/AnimatorPlaybackExample.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,25 @@
44

55
namespace Adnc.AnimatorHelpers.Examples {
66
public class AnimatorPlaybackExample : MonoBehaviour {
7+
private Animator anim;
8+
79
[SerializeField]
810
private AnimatorPlayback _completeEvent;
911

1012
[SerializeField]
1113
private string _completeMessage = "Detected animation playback as complete";
1214

1315
private void Start () {
16+
anim = GetComponent<Animator>();
17+
18+
// To play with a coroutine that waits for the conditions
1419
StartCoroutine(DetectEventComplete());
20+
21+
// To play without any coroutine or wait conditions
22+
// _completeEvent.Play(anim);
1523
}
1624

1725
IEnumerator DetectEventComplete () {
18-
var anim = GetComponent<Animator>();
1926
yield return _completeEvent.PlayCoroutine(anim);
2027
Debug.Log(_completeMessage);
2128
}

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,70 @@
22

33
A micro-framework for changing Unity 3D's Animator parameters with ScriptableObject(s). Designed to make going from
44
custom scripts to Animator parameters easy. Works with 2D or 3D projects.
5+
6+
## Quick Start Guide
7+
8+
### AnimatorPlayback Objects
9+
10+
How to use an AnimatorPlayback to play animations with variables.
11+
12+
![Preview of Playback Helper](/playback-helper-example.png)
13+
14+
1. Right click in the project window
15+
1. Go to Create -> ADNC -> Animator Variables -> Animator Playback
16+
1. Set your variables and true conditions on the object
17+
1. Attach the object to a MonoBehavior as so `AnimatorPlayback playback;`
18+
1. Call `playback.Play(MY_ANIMATOR);` to trigger the variables.
19+
20+
Example script.
21+
22+
```c#
23+
public class AnimatorPlaybackExample : MonoBehaviour {
24+
private Animator anim;
25+
26+
[SerializeField]
27+
private AnimatorPlayback _completeEvent;
28+
29+
[SerializeField]
30+
private string _completeMessage = "Detected animation playback as complete";
31+
32+
private void Start () {
33+
anim = GetComponent<Animator>();
34+
35+
// To play with a coroutine that waits for the conditions
36+
StartCoroutine(DetectEventComplete());
37+
38+
// To play without any coroutine or wait conditions
39+
// _completeEvent.Play(anim);
40+
}
41+
42+
IEnumerator DetectEventComplete () {
43+
yield return _completeEvent.PlayCoroutine(anim);
44+
Debug.Log(_completeMessage);
45+
}
46+
}
47+
```
48+
49+
Note that the AnimatorPlayback objects are fully unit and runtime tested
50+
due to their level of complexity.
51+
52+
## Animator Behaviors
53+
54+
There are several animator helper scripts to assist you with Animator Behavior(s).
55+
These are aimed at allowing you to interact with the Animator without having to write
56+
additional scripts to tweak variables and playback.
57+
58+
![Preview of Playback Helper](/animator-helpers.png)
59+
60+
### Available Helpers
61+
62+
Here is a brief list of helpers. New ones will be added as the repo is updated over time.
63+
64+
* SetVarBool
65+
* SetVarRandomBool
66+
* SetVarFloat
67+
* SetVarRandomFloat
68+
* SetVarInt
69+
* SetVarRandomInt
70+
* RandomSpeed
71+
* RandomStartTime

animator-helpers.png

58.7 KB
Loading

playback-helper-example.png

36.7 KB
Loading

0 commit comments

Comments
 (0)