Example #1
0
    public void ReactToHit()
    {
        WanderingAI behaviour = this.GetComponent <WanderingAI>();

        if (null != behaviour)
        {
            behaviour.SetIsAlive(false);
        }

        StartCoroutine(Die());
    }
Example #2
0
    /// <summary>
    /// 对击中作出反应
    /// </summary>
    public void ReactToHit()
    {
        WanderingAI behaviour = this.GetComponent <WanderingAI>();

        if (null != behaviour)
        {
            // 停止被击中对象的漫游行为
            behaviour.SetIsAlive(false);
        }

        // 播放死亡效果
        StartCoroutine(Die());
    }