Exemple #1
0
    private void OnUnitRemoved(Unit u)
    {
        var uid = u.UID;

        IndLayer.DestroyBloodbar(uid);
        IndLayer.DestroyProgressbar(uid);
        IndLayer.DestroyWaitingNum(u.UID);

        // 部分单位立即移除,其它单位都是延迟移除,以便播放死亡动画
        if (u.cfg.IsBuilding && !u.BuildingCompleted)
        {
            UC.RemoveModel(uid, 0);
        }
        else
        {
            var mu = UC.GetModel(uid);
            if (mu != null && mu.AniPlayer != null)
            {
                mu.AniPlayer.Die();
            }

            UC.RemoveModel(uid, 1);
        }

        if (u.UnitType == "TreasureBox")
        {
            var type = u.Tag as string;
            UIManager.Instance.Tips.AddSmallTip(TreasureBoxRunner.GetDisplayName(type), u.Pos);
        }
    }