Esempio n. 1
0
    private void TryDialog()
    {
        if (StageMgr.MainPlayer != null)
        {
            var deploy = DialogMgr.GetBossDialog(StageMgr.MainPlayer.Deploy.id, Deploy.id, true);
            if (deploy != null)
            {
                var list = DialogMgr.GetDrawList(deploy.dialogId);
                UIDrawingChat.Show(list,
                                   () =>
                {
                    MoveToTarget(BossUpCenter, 10f);
                },
                                   () =>
                {
                    StartFight();
                    if (deploy.bgmId > 0)
                    {
                        Sound.PlayMusic(deploy.bgmId);
                        UIBgmTip.Show(deploy.bgmId);
                    }
                });
                return;
            }
        }

        //如果没有对话,直接移动到指定位置,并开始战斗
        MoveToTarget(BossUpCenter, 10f);
        DOVirtual.DelayedCall(1.15F, StartFight, false);
    }
 private void Awake()
 {
     dialogMgr         = GetComponent <DialogMgr>();
     speechManager     = GetComponent <SpeechManager>();
     microphoneManager = GetComponent <MicrophoneManager>();
     instance          = this;
 }
Esempio n. 3
0
    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);
    }
Esempio n. 4
0
    void SetParent()
    {
        DialogMgr root = GameObject.FindObjectOfType <DialogMgr>();

        if (null != root)
        {
            Transform parent = this.transform.parent;
            if (parent != root.transform)
            {
                this.transform.SetParent(root.transform);
                RectTransform rect = this.GetComponent <RectTransform>();
                rect.offsetMax  = Vector2.zero;
                rect.offsetMin  = Vector2.zero;
                rect.localScale = Vector3.one;
            }
        }
    }
Esempio n. 5
0
 static public DialogMgr GetInstance()
 {
     if (instance == null)
     {
         instance = new DialogMgr();
     }
     return instance;
 }