コード例 #1
0
ファイル: Boss.cs プロジェクト: zhfelon1/th-haruhi
    private void StartFight()
    {
        //第一符卡,播放收放特效(关卡中途加入的boss不需要)
        if (!CardMgr.IsSingleCard())
        {
            PlayShirnkEffect(true);
        }

        //bossMark显示
        UIBattle.SetBossMarkActive(true);

        //血条
        var bossHpHudObj = ResourceMgr.Instantiate(ResourceMgr.LoadImmediately(BossHpBar));

        bossHpHudObj.transform.SetParent(gameObject.transform, false);
        _bossHpHud = bossHpHudObj.GetComponent <UIBossHpComponent>();
        _bossHpHud.Canvas.sortingOrder = SortingOrder.EnemyBullet + 1;
        _bossHpHud.Canvas.worldCamera  = StageCamera2D.Instance.MainCamera;

        //boss背景
        var circle = ResourceMgr.Instantiate(ResourceMgr.LoadImmediately(BossHpCircle));

        circle.transform.SetParent(gameObject.transform, false);
        _bossCircle = circle.GetComponent <UIBossCircleComponent>();

        //bossCard
        DOVirtual.DelayedCall(1F, CardMgr.OnStartFight, false);

        //禁止无敌
        Invisible = false;

        //场景卷轴恢复
        StageSceneBase.RevertSpeed();
    }
コード例 #2
0
ファイル: Boss.cs プロジェクト: zhfelon1/th-haruhi
    private IEnumerator DoBossDead()
    {
        //对话配置
        var dialogDeploy = DialogMgr.GetBossDialog(StageMgr.MainPlayer.Deploy.id, Deploy.id, false);

        //隐藏血条
        SetHpHudActive(false);

        //bossMark隐藏
        UIBattle.SetBossMarkActive(false);

        yield return(new WaitForSeconds(0.3f));

        //震屏
        if (StageCamera2D.Instance)
        {
            StageCamera2D.Instance.Shake(0.7f, 1.2f);
        }
        if (StageCamera3D.Instance)
        {
            StageCamera3D.Instance.Shake(0.7f, 1.2f);
        }

        Sound.PlayUiAudioOneShot(105);

        //播放shader特效
        StageCamera2D.Instance.PlayDeadEffect(transform.position);

        //隐藏renderer
        MainRenderer.enabled = false;
        if (_bossCircle)
        {
            _bossCircle.SetActiveSafe(false);
        }

        yield return(new WaitForSeconds(0.7f));

        //尝试显示对话
        if (dialogDeploy != null)
        {
            var list = DialogMgr.GetDrawList(dialogDeploy.dialogId);
            UIDrawingChat.Show(list, null,
                               () =>
            {
                GameEventCenter.Send(GameEvent.OnEnemyDie);
            });
        }
        else
        {
            GameEventCenter.Send(GameEvent.OnEnemyDie);
        }

        yield return(new WaitForSeconds(0.3f));

        Destroy(gameObject);
    }