Game Development Reference
In-Depth Information
Getting curvy
If you recall, back in Chapter 3 , Getting Animated , I showed you the animation curves
that can alter how a sprite or inspector value can be changed over time. You can also use
these just about anywhere in Unity. So, we'll apply this to our MapMovement script to
control how the player transits from his start position to his destination. To do this, simply
add a new public parameter to the top of the MapMovement script (this can work on
any script implementing MonoBehaviour ) as follows:
public AnimationCurve MovementCurve;
When viewed from the editor, this will give you the custom inspector for an animation
curve as shown in the following screenshot:
Note
You have to configure the curve initially from the editor for it to do anything; the default
is simply a flat line with no movement.
When you click on the curve, you will get the animation curve editor, as shown in the fol-
lowing screenshot:
Search WWH ::




Custom Search