Game Development Reference
In-Depth Information
Figure 5-18. Building a transition from the default state to the death state
Making Death: Scripting with Mecanim
Together, the animation clip and the Animation Controller define the animation key frames and
general playback logic. But still, the act of triggering and playing the animation when death occurs
needs to be coded. This will be achieved by amending the PlayerController.cs script (see Listing
5-5 for further PlayerController refines, followed by comments).
Listing 5-5. Refining PlayerController for a Death Animation
01 //------------------------------------------------
02 using UnityEngine;
03 using System.Collections;
04 using System.Collections.Generic;
05 //------------------------------------------------
06 public class PlayerController : MonoBehaviour
07 {
08 //------------------------------------------------
09 //Amount of cash player should collect to complete level
10 public float CashTotal = 1400.0f;
11
 
Search WWH ::




Custom Search