Game Development Reference
In-Depth Information
You can copy and paste the keys if you wish, but the key generated at 1:00 will ensure a proper loop
cycle. The stork should look as if he's muttering to himself.
12.
Close the Animation view.
The Animator setup will be fairly simple. The two clips you made for the beak have automatically
been added. To trigger the Beak open, you will be creating a Trigger parameter.
1.
With the Lower Beak selected, open the Animator view.
2.
Right-click over the Beak Clack state, and choose “Set as Default.”
3.
In the Parameters area, at the lower left, click the plus sign and create a new
Trigger type parameter.
4. Name it Cue the Beak .
Trigger type parameters are Booleans that are automatically set back to false after they have been
triggered, which saves you lots of scripting.
5.
Create a transition from Beak Clack to Beak Open.
6.
Set its Condition to “Cue the Beak.”
7.
Create a transition from Beak Open to Beak Clack.
8.
Leave its Condition set to Exit Time.
9.
Click Play, and watch the stork as he mutters to himself while making his way
across the screen.
10.
With the beak selected, click to turn on the “Cue the Beak” parameter
halfway across.
The beak opens once, closes, and then resumes its clacking behavior.
11.
Exit Play mode and uncheck the “Cue the Beak” parameter.
When you change a parameter during runtime, it does not revert to its prior state when you exit
Play mode.
To cue the beak open, you will return to the SpawnBunnies script where you cue the stork.
The Animator component must be identified, but the triggering is a single line of code.
1.
Open the SpawnBunnies script.
2.
Add the following variable:
public Animator beak; // the lower beak's animator component
In the StartReproducing function, change the 3f in the second yield return
new to a random number between 1 and 2:
3.
yield return new WaitForSeconds(Random.Range (1f,2f)); // finish the adjusted time
 
Search WWH ::




Custom Search