O'Reilly logo

Mastering Unity 5.x by Alan Thorn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Developing the Dead state

After the zombie enters the Death state within the animator graph, it remains there and cannot revert to any other state. The animator graph simply suspends, without linking to any new state:

Developing the Dead state

Death state

The code is therefore pretty simple:

    //------------------------------------ 
    public IEnumerator StateDead() 
    { 
        //Run dead animation 
        ThisAnimator.SetInteger("AnimState", (int) ActiveState); 
 
        //While in idle state 
        while(ActiveState == AISTATE.DEAD) 
        { 
             yield return null; 
        } 
    } 
    //------------------------------------  

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required