噩梦 游戏结束 检测血量执行动画

时间:2015-07-28 21:18:09   收藏:0   阅读:284
using UnityEngine;


namespace CompleteProject
{
    public class GameOverManager : MonoBehaviour
    {
        public PlayerHealth playerHealth;       // Reference to the player‘s health.




        Animator anim;                          // Reference to the animator component.




        void Awake ()
        {
            // Set up the reference.
            anim = GetComponent <Animator> ();
        }




        void Update ()
        {
            // If the player has run out of health...
            if(playerHealth.currentHealth <= 0)
            {
                // ... tell the animator the game is over.
                anim.SetTrigger ("GameOver");
            }
        }
    }
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文:http://blog.csdn.net/haifeng619/article/details/47109431

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!